identity

Insert data in to sql server data table

Hi , I have one table customer_master and column cust_id is autoincrement 1 .when we are try to insert its working fine and inserted records like cust_id 1 and 2,3,4 but when generate error in insert command we do transaction rollback means cust_id 5 is not insert but when we are insert another record cust_id generate 6 . skip cust_id...

sql server merge with multiple insert when not matched

Hi. I'm using MERGE in my query and i'm making INSERT on clause WHEN NOT MATCHED THEN, but then i would like to get the inserted row identity and make another INSERT to some other table. Query for now is: ALTER PROCEDURE [dbo].[BulkMergeOffers] @data ImportDataType READONLY AS SET NOCOUNT ON; DECLARE @cid int = 0 MERGE dbo.oferta AS ta...

Why does id({}) == id({}) and id([]) == id([]) in CPython?

Why does CPython (no clue about other Python implementations) have the following behavior? tuple1 = () tuple2 = () dict1 = {} dict2 = {} list1 = [] list2 = [] # makes sense, tuples are immutable assert(id(tuple1) == id(tuple2)) # also make...

Command to get identity of newly inserted record in Interbase 2007

In Interbase (I'm using 2007, I don't know if it matters) is there a command to get the identity of a newly-inserted record, similar to SCOPE_IDENTITY() in SQL Server? ...

How do I get NHibernate to save an entity if I assign it an ID, but generate one otherwise?

According to the REST philosophy, a PUT request should update the resource at a URL if it exists, and create it if it doesn't exist. So in other words, if I use the following URL: PUT http://server/item/5 If an Item exists with an ID of 5, it will be updated. If an Item doesn't exist with an ID of 5, a new Item will be created with an...

Get Id after an INSERT in SQL Server in a multithread enviromment ?

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. ...

Is is possible to get new values for Id (IDENTITY) before inserting data in a table ?

Is is possible to get new values for Id (IDENTITY) before inserting data in a table ? Is is possible to write something like that : INSERT INTO Table1 SELECT *GET_NEW_IDENTITY*, Field1, Field2 FROM Table2 I need the values of Id because I want to insert data in Table1 and, just after, insert data in another table which has a foreign ...

Is it possible to get NHibernate to auto-generate an ID if the entity does not have one, or use the ID of the entity if it already has one?

According to REST philosophy, a PUT operation should (taken from Wikipedia): PUT http://example.com/resources/142 Update the address member of the collection, or if it doesn't exist, create it. NHibernate seems to have two ways of dealing with entity IDs: Auto-generate an ID, regardless of what value the user set. Use the ID as...

specify identity value in linq-to-sql

I am trying to set an identity field's value before inserting the new record into the database, I am trying to save having to needlessly re-map all of the FK fields when I know the destination tables are empty already. I had hoped that this question: http://stackoverflow.com/questions/507515/how-do-i-manually-set-an-identity-field-in-li...

How to identify a database as valid model?

Im having trouble identifying my databases as correct and valid version of my model. I have a GUID-id for my model I could use, but where do I put it? I dont want an entire table with only one row for this GUID. Is there any metadata-repository for databases (SQL Server 2008) or is there any other methods of identifying databases except ...

how i can identify which process is making UDP traffic on linux ?

Hello, my machine is continously making udp dns traffic request. what i need to know is the PID of the process generating this traffic. The normal way in TCP connection is to use netstat/lsof and get the process associated at the pid. Is UDP the connection is stateles, so, when i call netastat/lsof i can see it only if the UDP socket...

Hibernate exception while using "identity" generator - how to use

I am using Hibernate over SQL Server for a web application. I was using the "increment" generator class till now and recently ran into ConstraintViolation exceptions. So, I changed the generator to "identity" and I am getting the following error - Cannot insert the value NULL into column 'assessment_administration_id', table 'faip....

How do I create an entity through a RESTful PUT with NHibernate?

According to REST philosophy, a PUT operation should create an entity if it doesn't exist, or update it if it does. So for example, if a client does this operation: PUT http://server/user/5?firstname=John&lastname=Doe I should expect that a user with an ID of 5 either be created or updated. The update case is easy with NHibernate...

Identity insert - performance

I have one solution where I insert rows where I use GUIDs instead of an Identity. The Guid is generated in c#. I have another solution where the table, indexes etc are identical, but instead of GUIDs I use identities and let Sql-server generate them. In the later case I get a performance issue.... Ideas? //Daniel EDIT I really am so...

How to 'select' the current identity value for a table?

dbcc checkident (MyTable, NORESEED) Will show the identity value in a message. I can't see the message as I need to select the identity value through a DataReader. Anyone any ideas? Thanks folks ...

asp.net user identity returns application pool identity

I have a web server farm with 2 windows 2008 r2 server nlb configured. I am trying to get the identity of the current logged in user but instead I get the application pool user. Not sure what I'm doing wrong. any ideas? here's the code I'm using protected void Page_Load(object sender, EventArgs e) { Response.Write(User....