Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rock5974
Starting Member
1 Post |
Posted - 2008-11-20 : 16:51:11
|
Hello new FriendzI create the insert query in the wizard.I add the STATEMENTS, WHILE, BEGIN, END, etc....I am trying to get a loop going to put a number in one colum and a prefix in another. It will not currently get past the first SELECT statement. Please help. It says syntax error near keyword select.*******************************************************CREATE PROCEDURE [insert_tbl_Sample_Num_SW_1] (@col_Sample_Num_1 [int], @col_Prefix_SW_2 [char](12)) SELECT @col_Sample_Num_1 = 1 SELECT @col_Prefix_SW_2 = 'StANTSW'WHILE (@col_Sample_Num_1 < 3) BEGIN AS INSERT INTO [SAW_ProjData].[dbo].[tbl_Sample_Num_SW] ( [col_Sample_Num], [col_Prefix_SW]) VALUES ( @col_Sample_Num_1, @col_Prefix_SW_2)SELECT @col_Sample_Num_1 = @col_Sample_Num_1 + 1ENDGO |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-11-20 : 16:55:22
|
quote: Originally posted by rock5974 Hello new FriendzI create the insert query in the wizard.I add the STATEMENTS, WHILE, BEGIN, END, etc....I am trying to get a loop going to put a number in one colum and a prefix in another. It will not currently get past the first SELECT statement. Please help. It says syntax error near keyword select.*******************************************************CREATE PROCEDURE [insert_tbl_Sample_Num_SW_1] (@col_Sample_Num_1 [int], @col_Prefix_SW_2 [char](12))AS SELECT @col_Sample_Num_1 = 1 SELECT @col_Prefix_SW_2 = 'StANTSW'WHILE (@col_Sample_Num_1 < 3) BEGIN AS INSERT INTO [SAW_ProjData].[dbo].[tbl_Sample_Num_SW] ( [col_Sample_Num], [col_Prefix_SW]) VALUES ( @col_Sample_Num_1, @col_Prefix_SW_2)SELECT @col_Sample_Num_1 = @col_Sample_Num_1 + 1ENDGO
|
|
|
|
|
|
|
|