April 30, 2008 at 1:01 pm
I have a table of healthcare claims data for which I would like to have a unique identifier for each row. I have acheived this in the past by creating a temporary table with an identity column and then inserting those rows into my final table. I use a variable to find the maximum value in the destination table. The data type in the final table, in this example, is bigint.
I will receive claims data on a recurring basis from various clients and I am creating a procedure to add the new claims to an existing table.
I was wondering if I could directly insert the claims into the destination table which will have an identity column. I tried to use NEWID() and that did not work.
Here is a sample of my insert statement:
Insert Into DEV..REBATEPRIMARY
SelectNEWID(),
[company name],
[subscriber ID],
[process date],
etc.
from DEV..RBT_test
Thanks
April 30, 2008 at 1:05 pm
If the target table has an identity column defined, then don't include it in your insert statement and it will be automatically populated at the time of insert.
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgApril 30, 2008 at 1:17 pm
Wow, that was too easy.
Thanks so much. Tested that and it worked perfectly.
April 30, 2008 at 1:20 pm
Yes, we all know too well that sometimes the hardest problem we work on is right in front of our face. :hehe:
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgViewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply