How do I reset an increment identity's starting value in SQL Server
I would like to have a nice template for doing this in development. ...
I would like to have a nice template for doing this in development. ...
In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a Select statement right ...
Is there a cross database platform way to get the primary key of the record you have just inserted? I noted that this answer says that you can get it by Calling SELECT LAST_INSERT_ID() and I think that you can call SELECT @@IDENTITY AS 'Identity'; is there a common way to do this accross databases in jdbc? If not how would you suggest ...
Say I have an MSSQL table with two columns: an int ID column that's the identity column and some other datetime or whatever column. Say the table has 10 records with IDs 1-10. Now I delete the record with ID = 5. Are there any scenarios where another record will "fill-in" that missing ID? I.e. when would a record be inserted and giv...
In my eternal saga to insert 1.4 million rows of data from a SQL script, I've written a basic WinForms app that takes each line of the script and executes it individually. However, because the original script contained SET IDENTITY_INSERT [Table] OFF and SET is a session-wide command, this setting is getting lost on every SQL call, m...
I had an unusual problem yesterday where I was suddenly unable to insert records into a table with an identity column. A simple insert like this: INSERT INTO MyTable (Column1, Column2) VALUES ('text', 236764) Started throwing a primary key constraint violation. I ran DBCC CHECKIDENT on the table, and realized that SQL Server had stop...
Hi, Can I map the identity of an entity to a column whose values are not auto-generated (but still unique)? If so, what should I put in the xml identity/generator tag? Thanks. ...
What's the most efficient way of getting the value of the SERIAL column after the INSERT statement? I.e. I am looking for a way to replicate @@IDENTITY or SCOPE_IDENTITY functionality of MS SQL ...
I'm currently performing a migration operation from a legacy database. I need to perform migration of millions of originating rows, breaking the original content apart into multiple destination parent / child rows. As it's not a simple 1 to 1 migration and the the resulting rows are parent / children row based on identity generated key...
What happen when SQL Server 2005 happen to reach the maximum for an IDENTITY column? Does it start from the beginning and start refilling the gap? What is the behavior of SQL Server 2005 when it happen? ...
In SQL Server (in my case, 2005) how can I add the identity property to an existing table coulumn using t-sql? something like: alter table tblFoo alter column bar identity(1,1) ...
I was previously getting the next available autonumber used in Access by doing a simple query like so: SELECT RecordNumber, Info FROM myTABLE WHERE 0=1 This way I could create a variable to hold the currentRecord and it will use the same autonumber that Access was going to use when I was updating the row Example rs.AddNew currentRec...
We currently have a setup like this: lan\john lan\application1 lan\appService1 lan\appService2 client ------> website ----------> WCF Service1 ------> WCF Service2 So each website/service runs as a different identity account that is setup in active directory. Security checks are based on the identity of the immediate ca...
I can't figure out how to get the SCOPE_IDENTITY() back to my variables from an SQL2005 Store Procedure. My sSQL String: sSQL = "EXEC [sp_NewClaim] " & Chr(34) & ClaimNumber & Chr(34) & ", " & Request.Cookies("UserID") & ", " & Request.Cookies("MasterID") & ", " & Chr(34) & strRestaurante & Chr(34) & ", " & Chr(34) & Fecha & Chr(34) &...
Why does the following behave unexpectedly in Python? >>> a = 256 >>> b = 256 >>> a is b True # this is an expected result >>> a = 257 >>> b = 257 >>> a is b False # what happened here? why is this False? >>> 257 is 257 True # yet the literal numbers compare properly I am using Python 2.5.2. Trying some di...
I'm interested to know if there's any sites out there that has implemented CardSpace as an alternative authentication. I certainly like to see how different it is from, say, using OpenID. ...
Given two interface references obtained from different sources. Is there a programmatic way to tell whether they're implemented by the same instance? A simple equality check of the interface references always fails. EDIT: Large parts of the original question, which turned out to be an independent problem have now been moved to a new ...
[continued from Is there a way to tell whether two COM interface references point at the same instance?] I've got references to Inspector objects from two different sources and need to be able to tell which item from one source corresponds to which item from the other source. However, none of the approaches I have been able to come up w...
I need to programatically find the users name using C#. Specifically, I want to get the system/network user attached to the current process. I'm writing a web application that uses windows integrated security. ...
I'm using JSLint to go through some horrific JavaScript at work and it's returning a huge number of suggestions to replace == with === when doing things like comparing 'idSele_UNVEHtype.value.length == 0' inside of an if statement. I'm basically wondering if there is a performance benefit to replacing == with ===. Any performance improv...