Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > Sybase

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-29-2008, 08:28 PM
mpeppler@peppler.org
 
Posts: n/a
Default Re: Facing problem in Executing Stored Procedure for Sybase12.0

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-29-2008, 08:28 PM
Carl Kayser
 
Posts: n/a
Default Re: Facing problem in Executing Stored Procedure for Sybase12.0


"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".


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 08:28 PM
Mike
 
Posts: n/a
Default Facing problem in Executing Stored Procedure for Sybase12.0

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-02-2008, 05:05 AM
Keith
 
Posts: n/a
Default Re: Facing problem in Executing Stored Procedure for Sybase12.0

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145