Wednesday, March 28, 2012

How to insert an automated ID?

Unfortunately don't I know, how I can adjust this or whether SQL code is needed and if, where? I do not know myself unfortunately yet so well with the subject out, from therefore am grateful I for each assistance. Many greetings M-l-g

Hello,

I have a problem with an integration services project of SQL server 2005. I have a text file with various data, which can be read out easily with a dataflow task and a flat file source. The data shall be transferred into a target database which I developed according to a star pattern. The fact table can be generated automatically if and only if all data belonging to a dimension table is inserted by myself. Of course, this procedure is not reasonable while having a vast amount of data. That is the reason why I want to generate the dimension tables automatically, too. A dimension is build e.g. like this: ApplicationID | ApplicationName. So, only two columns are available. But I don't know how to insert an automated ID.

I would be thankful for any help.

M-l-GYou can use the rownumber component to add another column with the row number in it.
Also see http://www.sqlis.com/60.aspx for more row counting components.|||

Thank you for the answer but I already found the solution for this problem myself, after I spent some time to look for it.

While creating an ID-column in the database with SQL Server Management Studio there is a property called "Identity specification" and "Is identity". These properties have to be set on "Yes". Afterwards, you are able to enter values for "ID-Steprange" and "ID-Startvalue".

With regards

M-l-G

|||

M-l-G wrote:

Thank you for the answer but I already found the solution for this problem myself, after I spent some time to look for it.

While creating an ID-column in the database with SQL Server Management Studio there is a property called "Identity specification" and "Is identity". These properties have to be set on "Yes". Afterwards, you are able to enter values for "ID-Steprange" and "ID-Startvalue".

With regards

M-l-G

You are better off NOT using the identity columns in SQL Server, and generating your own in SSIS:

http://www.ssistalk.com/2007/02/20/generating-surrogate-keys/

No comments:

Post a Comment