Tag: database-design

Missing data in table

I have a SQL challenge My data provider send me a CSV data formatted like the example below Now for some reason the file is missing data perhaps to save space and make the tables smaller, I’m not sure. In the Field_1 and Field_2 there is missing data. the data is present in one record […]

Database having the exact same row of record..Why so?

I have this issue over my DB..There is two row of record with exact same value, which doesn’t make sense to me as I tried to insert the exact value using MS SQL Server, the client itself will prompt error –> ‘Violation of UNIQUE KEY constraint ‘IDX_XXX’. Cannot insert duplicate key in object ‘table XXX’. […]

Should i create seperate sql server database for each user?

I am working on Asp.Net MVC web application, back-end is sql server 2012. This application will provide billing, accounting and inventory management. User will create account by signup. just like http://www.quickbooks.in. Each user will create some masters and various transactions. There is no limit, user can make unlimited records in database. I want to keep […]

SQL Primary Key Decisions

In my scenario I am tracking a population of members and their doctor changes The columns concerned are MemberID | Prov_Nbr | Prov_Start_Date | Prov_End_Date | Prov_Update_Date My question is in regards to a primary key In this scenario, would it be better to have a primary key on an Auto-Increment field, and add the […]

SQL Server : database design – composite primary key

I need your suggestion on how to implement SQL Server table relationships. I have many customers, each holds a unique id (customerID) each customer can have many categories associated (categoryID) each customer can have many sub categories (subCategoryID) for when a customer logs in I know its CustomerID, CategoryID and SubCategoryID. customer plans in advance […]

Does the location of a stored procedure affect its performance?

I have a large application which contains “modules” such as Finance, HR, Sales, Customer Service. To make the application manageable and to distribute the load, I have decided to give each module its own database on a single server. There is also going to be a Master database for holding master information such as information […]

Should all tables be related in a Database or Is it ok to leave some of them?

Often we come across some small insignificant (debatable) tables left out as stand alone. Although they are used in joins (sparingly) but still developers don’t bother to relate them. May be too many References made the inserts slow. This leads to this question : As a thumb rule should we relate all the tables in […]

Creating a generalized table in SQL Server

We have a client-server system that uses SQL Server 2012 as a database. The system is updated and enhanced on a regular basis. We recently realized we have a recurring pattern of table design: a table that links the Users table to other tables in the database, forming a basis for views and permissions. Example: […]

Joins etc. with GUID as Primary Key on SQL Server

Looking at this post: [What are the best practices for using a GUID as a primary key, specifically regarding performance? I understand that if I want to use a GUID as the primary key then this should be non-clustered pk and then also create a clustered int unique index (autoinc). I just want to confirm […]

Why nested loop block appear in acutal exection plan?

I work on a testing social website. I was asked to create index for the query that get the pages that a user follows.I am new to indexes so I created three tables and filled them with 4500000 records for testing. The three tables are the same except for the primary key and indexes. The […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.