I got a peculiar doubt.... rather its a simple one too. How to insert records in the bleow table, create table Venkattemp (id int identity(1,1)) Thanks and Regards, Venkatesan Prabu .J http://venkattechnicalblog.blogspot.com/
Identity columns - why do want to insert any specific value into them? If you must, you could do something along there lines:set identity_insert mytable on insert into mytable (identitycolumn) values (your integer value) set identity_insert mytable off This is your second question on identity columns where you simply don't know the proper syntax - please look stuff up in Books Online before posting.
[quote user="Adriaan"] Identity columns - why do want to insert any specific value into them? If you must, you could do something along there lines:set identity_insert mytable on insert into mytable (identitycolumn) values (your integer value) set identity_insert mytable offThis is your second question on identity columns where you simply don't know the proper syntax - please look stuff up in Books Online before posting. [/quote] Another way to populate it in the actual order is insert into Venkattemp default values I have seen this approach to populate a number table. You just need a loop to execute that code
[quote user="Madhivanan"]I have seen this approach to populate a number table. You just need a loop to execute that code[/quote] Or you can specify the number after GO statement too. Eg.. insert into Venkattemp default values; GO 10
[quote user="preethi"] [quote user="Madhivanan"]I have seen this approach to populate a number table. You just need a loop to execute that code[/quote] Or you can specify the number after GO statement too. Eg.. insert into Venkattemp default values; GO 10 [/quote] Yes provided the version is later than 2000
[quote user="Madhivanan"] [quote user="preethi"] [quote user="Madhivanan"]I have seen this approach to populate a number table. You just need a loop to execute that code[/quote] Or you can specify the number after GO statement too. Eg.. insert into Venkattemp default values; GO 10 [/quote] Yes provided the version is later than 2000 [/quote] Hm, this question was asked in the "SQL Server 2008" forums.... []
<P mce_keep="true">[quote user="FrankKalis"] <P>[quote user="Madhivanan"]</P><P>[quote user="preethi"] </P><P> [quote user="Madhivanan"]I have seen this approach to populate a number table. You just need a loop to execute that code[/quote]</P><P>Or you can specify the number after GO statement too.</P><P>Eg.. </P><P><FONT color=#0000ff size=2><FONT color=#000000 size=2>insert into Venkattemp default values; </FONT></FONT></P><P><FONT color=#0000ff size=2><FONT color=#000000 size=2>GO 10 <BR></FONT></FONT></P><P>[/quote]</P><P>Yes provided the version is later than 2000</P><P>[/quote] </P><P>Hm, this question was asked in the "SQL Server 2008" forums.... <IMG alt=Wink src="http://sql-server-performance.com/Community/emoticons/emotion-5.gif" mce_src="http://sql-server-performance.com/Community/emoticons/emotion-5.gif"> <BR></P><P>[/quote]</P><P>Thanks []</P><P>But I think it is worth to specify it []</P>
Sorry for my bad temper earlier on on this thread ... I learned something new (GO 10) ... and was reminded of something I do not regret forgetting (INSERT INTO table DEFAULT VALUES)
[quote user="venkatesanj@hcl.in"] Thanks to all. I have learnt something today. Cheers, Venkatesan Prabu .J [/quote] How about displaying my answer to your blog post? I already replied and you didn't publish it yet http://venkattechnicalblog.blogspot.com/2010/01/sql-query-challenge.html
[quote user="Adriaan"] Sorry for my bad temper earlier on on this thread ... I learned something new (GO 10) ... and was reminded of something I do not regret forgetting (INSERT INTO table DEFAULT VALUES) [/quote] You may need to read these http://sqlblogcasts.com/blogs/madhivanan/archive/tags/GO/default.aspx
[quote user="Madhivanan"] [quote user="Adriaan"] Sorry for my bad temper earlier on on this thread ... I learned something new (GO 10) ... and was reminded of something I do not regret forgetting (INSERT INTO table DEFAULT VALUES) [/quote] You may need to read these http://sqlblogcasts.com/blogs/madhivanan/archive/tags/GO/default.aspx [/quote] What a shameless plug this is...[]
<P mce_keep="true">[quote user="FrankKalis"] <P>[quote user="Madhivanan"]</P><P>[quote user="Adriaan"] </P><P>Sorry for my bad temper earlier on on this thread ...</P><P>I learned something new (<STRONG>GO 10</STRONG>) ...</P><P>and was reminded of something I do not regret forgetting (<STRONG>INSERT INTO </STRONG><EM>table </EM><STRONG>DEFAULT VALUES</STRONG>)</P><P>[/quote]</P><P>You may need to read these </P><P><A href="http://sqlblogcasts.com/blogs/madhivanan/archive/tags/GO/default.aspx">http://sqlblogcasts.com/blogs/madhivanan/archive/tags/GO/default.aspx</A></P><P mce_keep="true"> </P><P>[/quote] </P><P>What a shameless plug this is...<IMG alt="Big Smile" src="http://sql-server-performance.com/Community/emoticons/emotion-2.gif"> <BR></P><P>[/quote]</P><P>Adriaan specified the thing G0 10 was new to him so as my reply []</P>
[quote user="venkatesanj@hcl.in"] I got a peculiar doubt.... rather its a simple one too. How to insert records in the bleow table, create table Venkattemp (id int identity(1,1)) [/quote] Looking at the table name, it may be a good idea to have a permanent number helper table. []