Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
6k views

Why am I receiving the identity insert error even after explicitly setting IDENTITY_INSERT ON and using a column list? [closed]

My code: SET IDENTITY_INSERT SomeCoolDatabase.BoringOldSchema.TableWithIdentityColumn ON INSERT INTO SomeCoolDatabase.BoringOldSchema.TableWithIdentityColumn SELECT ColumnWithIdentity, ...
J.D.'s user avatar
  • 39.5k
2 votes
2 answers
4k views

Does SQL Server automatically update the foreign key relationships between tables when one of those tables is renamed?

What happens to the foreign key relationships on a table if that table is renamed?
J.D.'s user avatar
  • 39.5k
1 vote
2 answers
70 views

Queries gaining by adding a new index

How would i be able to find out which queries would gain by adding a new index. Ex: Lets assume i add a new NCI on a table , how would i be able to find out which queries would benefit from adding ...
user avatar
3 votes
2 answers
4k views

How to read an excel file from a network machine using SQL?

I am trying to import some excel file data into a SQL table. I thought of using OPENROWSET for this. The issue is that the csv file is location in a different machine in the same network. How do I ...
AnOldSoul's user avatar
  • 471
1 vote
1 answer
5k views

Selecting rows from same name table from multiple databases in single result set

For some reason, I have a table Table_1 in n databases (same name and schema structure) instead of one single databases. The columns are like this: | Column_1 | Column_2 | I can select data from ...
Xameer's user avatar
  • 911
4 votes
2 answers
655 views

Should I set document version field to be part of a primary key

Should I set document version as a primary key I am working on a document management system, and I have these two tables representing part of the whole tables. On the DocumentVersion table I have ...
john Gu's user avatar
3 votes
1 answer
577 views

How to create a Relation between a table and a many-to-many relation table

I am buildng a new database inside an Sql server 2008 r2.I have the following tables & business rules:- Skill that have predefined levels assigned to it, such as junior, senior, manager. Staff ...
john Gu's user avatar
4 votes
1 answer
23k views

Standard data types for email address, telephone number , first name, rixh text editor, etc

I want to build a database for our system using Sql Server 2008 R2. but i need to know what are the best data types for storing these info:- Email address Telephone number with extension, such as +44 ...
john Gu's user avatar
-1 votes
2 answers
283 views

SSMS gives error if column name is "MERGE" where as other keywords works

IN SSMS create table if we include sql keywords in column name then it will be wrapped around square brackets "[]" automatically and the table gets created without any error generally. But if we ...
IT researcher's user avatar