How can I get id after an INSERT in SQL Server ?
For my insert, I use context.ExecuteStoreCommand()
Warning: I have a multi-threaded application which inserts "at the same time" some data in the same table.
...
Hi I have installed a Team Foundation Server 2010, and it works perfectly over my Lan, but I need it to work over the internet too.
My problem is that when Im connected to my team server over the internet, I get the following error, when I try to create a new Team project.
TF218027: The following reporting folder could not be created o...
I SSMS (2008R2) menu Tools --> Options --> Designers --> Table and Database Designers --> "Warn on null primary keys"
I played checking and unchecking this checkbox but could not detect the differences.
What is it for?
My related questions, probably:
NULL permitted in Primary Key - why and in which DBMS?
Why to use “not null pr...
Hi,
Just after a quick answer here. I've come across this view in a database I'm working on. It has a large code section beneath it which uses sp_addextendedproperties.
This code looks like it was generated by a tool to me (preview below) - can any one tell me which tool it likely came from and what the point of it is (Just some of the...
I have a very long T-sql script, it is a single batch, something like
DECLARE variables
select into temptable...
cursor...
insert...
update..
as I run the script I have
(1 row(s) affected)
(5 row(s) affected)
[...]
ERROR
(2 row(s) affected)
etc...
I would like to run step by step the script to identify which is the command...
Hi,
A little context first:
I would say I have good SQL server experience, but am a developer, not a DBA. My current task is to improve on the performance of a database, which has been built with a very heavy reliance on views. The application is peppered with inline sql, and using Tuning Advisor only suggests a couple of missing index...
What is ADO.NET and what difference between it and SQL Server?
...
Hello,
I've checked the documentation for SCOPE_IDENTITY(), and it says "A scope is a module: a stored procedure, trigger, function, or batch." That is simple when I'm running a query in SSMSE, but in C# I'm using SqlCommand for executing my statements.
The question is: what is the scope there? Is executing subsequent commands under on...
How can I make a big insertion with SqlBulkCopy from a List<> of simple object ?
Does I to implement my custom IDataReader ?
...
Is there a specific command in C# for SQL Server in order to INSERT a lot of rows with the condition : if a row already exists in database doens't duplicate it during insertion ?
Edited
In a sqlbulkcopy, I'd like to avoid exception because a row is already in the table ?
...
I working on application which can deal with multiple database servers like "MySQL" and "MS SQL Server".
I want to get tables names of a particular database using a general query which should suitable for all database types. I have tried following:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
But it ...
I have a SQL Server database designed like this :
TableParameter
Id (int, PRIMARY KEY, IDENTITY)
Name1 (string)
Name2 (string, can be null)
Name3 (string, can be null)
Name4 (string, can be null)
TableValue
Iteration (int)
IdTableParameter (int, FOREIGN KEY)
Type (string)
Value (de...
I need to understand about sql server transaction? I have gone through some articles available on google but I have not understood anything. Can anyone help me?
...
Hi I want restore database from backup file so i have used the following command
restore database myTestDbName from disk ='C:\temp\mybackuo.bak'
while executing the command I got following error
"The tail of the log for the database "myTestDbName" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains...
How can I check what mode a particular database is in?
...
hi,
I am configuring a server IIS7 to work with php and mssql in php.ini and when I try to call the "extension = php_mssql.dll" appears to me an error when I refresh the site.
"500 - Internal server error.
There is a problem with the resource you are looking for, and it can not be displayed. "
Thanks
...
Sorry for the rubbish title but hopefully this will explain:
Given the table
name | data
---------------------
1 | 1000
1 | 2000
1 | 3000
2 | 1500
2 | 2500
2 | 3500
I want to be able to select the top( x ) for all names ordered by the data value. So if x = 2 the retur...
I have a table which keeps parent-child-relations between items. Those can be changed over time, and it is necessary to keep a complete history so that I can query how the relations were at any time.
The table is something like this (I removed some columns and the primary key etc. to reduce noise):
CREATE TABLE [tblRelation](
[dtCr...
I want to find the average of the most recent x results. Is it possible to use an aggregate function on a limited number of results with sql server?
Here is what I have tried and the errors I get:
select avg(top(100) convert(float, AnalysisData))
from tab
order by DatePerformed desc
Msg 156, Level 15, State 1, Line 1
Incorrect s...
I'm trying to use EF to model an existing SQL database. The DB is multi-tenant by having a clientID column in every single table (I cannot change this). I have table structure like the following.
Table 'ItemID' columns:
ClientID (pk)
ItemID (pk)
ItemName
Table 'Items' columns:
ClientID (PK)
ItemID (PK) [FK to ItemID.ItemID]
Versi...