vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Apr 29, 11:30 am, Mike <apurv.agar...@gmail.com> wrote: > Dear All, > > I am facing a Problem in executing a SP fr Sybase12.0 > > Use Test1 > go > create table Data1(ID int,Names varchar(30),Names1 varchar(30),Primary > key(ID)) > go > > create procedure SP_Insert > AS BEGIN > > Declare @Input int ,@Count int > Set @Input = 100000 > Set @Count = 0 > > While @Count < @Input > > BEGIN > > Insert into Data1 Values(@Count,'hello1','hello1') > > select @Count = @Count + 1 > > END > > END > > Exec SP_Insert > Go > > For this I am getting an error: > > Error] Script lines: 6-32 ------------------------- > Incorrect syntax near '@Input'. > Msg: 102, Level: 15, State: 1 > Procedure: SP_Insert, Line: 9 > > Can some one help me on this? > > ----Mike In 12.0 you can't use "set" to assign a value to a variable. Replace set @input = ... by select @input = ... Michael |
| |||
| "Mike" <apurv.agarwal@gmail.com> wrote in message news:b88502ab-a361-4b00-91a9-39bb3eb4079b@i36g2000prf.googlegroups.com... Dear All, I am facing a Problem in executing a SP fr Sybase12.0 Use Test1 go create table Data1(ID int,Names varchar(30),Names1 varchar(30),Primary key(ID)) go create procedure SP_Insert AS BEGIN Declare @Input int ,@Count int Set @Input = 100000 Set @Count = 0 While @Count < @Input BEGIN Insert into Data1 Values(@Count,'hello1','hello1') select @Count = @Count + 1 END END Exec SP_Insert Go For this I am getting an error: Error] Script lines: 6-32 ------------------------- Incorrect syntax near '@Input'. Msg: 102, Level: 15, State: 1 Procedure: SP_Insert, Line: 9 Can some one help me on this? ----Mike Although I've seen it in newer ASE versions there is no need for "AS BEGIN". It is simply "as". And the last "END" would be replaced with "go". |
| |||
| Dear All, I am facing a Problem in executing a SP fr Sybase12.0 Use Test1 go create table Data1(ID int,Names varchar(30),Names1 varchar(30),Primary key(ID)) go create procedure SP_Insert AS BEGIN Declare @Input int ,@Count int Set @Input = 100000 Set @Count = 0 While @Count < @Input BEGIN Insert into Data1 Values(@Count,'hello1','hello1') select @Count = @Count + 1 END END Exec SP_Insert Go For this I am getting an error: Error] Script lines: 6-32 ------------------------- Incorrect syntax near '@Input'. Msg: 102, Level: 15, State: 1 Procedure: SP_Insert, Line: 9 Can some one help me on this? ----Mike |
| ||||
| See the fix (I thnk) in-line (>>>) ; do the same for the assignment to Count BTW, Count is a T-SQL keyword which may cause some weirdness... On Apr 29, 4:30*am, Mike <apurv.agar...@gmail.com> wrote: > Dear All, > > I am facing a Problem in executing a SP fr Sybase12.0 > > Use Test1 > go > create table Data1(ID int,Names varchar(30),Names1 varchar(30),Primary > key(ID)) > go > > create procedure SP_Insert > AS BEGIN > > Declare @Input int ,@Count int > Set @Input = 100000 >>> SELECT @Input = 100000 > Set @Count = 0 > > While @Count < @Input > > * * * * * * BEGIN > > * * * * * * Insert into Data1 Values(@Count,'hello1','hello1') > > * * * * * * select @Count = @Count + 1 > > * * * * * * END > > END > > * Exec SP_Insert > Go > > For this I am getting an error: > > Error] Script lines: 6-32 ------------------------- > *Incorrect syntax near '@Input'. > *Msg: 102, Level: 15, State: 1 > *Procedure: SP_Insert, Line: 9 * > > Can some one help me on this? > > ----Mike |