Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Original Identity for rows and test data

Status
Not open for further replies.

UnsolvedCoding

Technical User
Jul 20, 2011
424
US
I am creating a table from scratch and need to have a column that is an identifier for each row of information.

I have tried a few things but was wondering what suggestions there may be on the easiest way to do this?

Also, when it comes to putting test data into the new table whats the easiest way?
 
Humm... Not understanding your question or your a good guesser. The identity column is the best key to track row. Create it with type INT and in the properties under Identity Specification set IS ITDENTITY to yes.

As for the test data.

It depends on the type of data you need. If you have other data laying around that you can import and manipulate then that can be a good start etc.

Perhaps you have a more specific example of what you are looking for.

Simi
 
I have tried to use uniqueidentifier and couldn't get it to work with update or insert. I didn't see the IS IDENTITY so will try that.

My current problem is that everything in the select statment could have several different options and am working on case statements, however they don't like complex equations and I can't seem to get an if statment to work.

Right now the variables are being declared and populated prior to the insert or update statment and the case statments seem to be running out of control.

Basically what is happening is we have a program that captures information - document name, document extension, Document path, Document size and then it has several switches that are set so that on loading into the table the switches are all set to equal 1.

The first switch is to determine if a prep run was done on the documents. That switch gets set to zero once completed.

The next step is to determine if a link is good or bad. If its good that switch is set to zero, if not its left at 1.

The next switch trips when the document is identified as one of two possible types. 1 is no, zero is yes.

Finally, each time a record is updated it gets a counter bumped up by one.
 
Perhaps you could provide a data example and the expected output and we could make some recommendations.

Insert should increment your identity field.

Simi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top