Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Must declare the scalar variable "@name". SQL server 2005


Must declare the scalar variable "@name". SQL server 2005

Author
Message
pinnamanenihari
pinnamanenihari
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 4
THis is hw my Stored proc goes

Original

ALTER procedure [stpGetlist]
(

@Name varchar(255),

)

As

Declare @sName varchar(1000)
Declare @count bigint
select @sName = replace(replace(replace(@name,'.', '%'), '-', '%'), ',', '%')

In above decalration i had made like @Name

but when i am using in below i used like @name

and it gave the Error like+

Must declare the scalar variable "@name".

If i change the above into

select @sName = replace(replace(replace(@Name,'.', '%'), '-', '%'), ',', '%')

the stored proc is executing fine

can any one please suggest on this
Deepak-405225
Deepak-405225
SSC-Addicted
SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)

Group: General Forum Members
Points: 406 Visits: 598
I think Sql Server is having a case-sensitive collation and hence the above error message. You can confirm this by runnning,
sp_helpsort (or) SELECT SERVERPROPERTY ('Collation')

- Deepak
ChiragNS
ChiragNS
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2409 Visits: 1865
Hi

The only error i found was in your parameter declaration.

"@Name varchar(255)," . No need of a comma if its the only parameter there.

Check your server,db collation.

"Keep Trying"
pinnamanenihari
pinnamanenihari
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 4
hI AFTER RUNNING

select serverproperty ('Collation') THIS I GOT THE RESULT AS

SQL_Latin1_General_CP437_BIN

IS THERE ANY WAY WE CAN ALTER THIS
rajankjohn
rajankjohn
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1201 Visits: 575
for changing on a single database, you can use the ALTER DATABASE command. For changing the entire instance, you may need to rebuild the master database.

http://rajanjohn.blogspot.com
pinnamanenihari
pinnamanenihari
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 4
Finnaly the Problem was solved by rebuilding.

while installing the Sql- Server it will asl of Collation "Case- Insensitive", this was to be set corectly. To avoid the Issues mentioned above.

Thanks guys
du.pereira
du.pereira
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
Points: 25 Visits: 133
Couldn't you just go to database properties > options and select the right collation?
Deepak-405225
Deepak-405225
SSC-Addicted
SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)SSC-Addicted (406 reputation)

Group: General Forum Members
Points: 406 Visits: 598
In order to change the server level collation you need to rebuild the system databases. For changing database collation you can make use of alter database statement.

- Deepak
pinnamanenihari
pinnamanenihari
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 4
Yes Alter/ or modifying can be done ,
But not to System DataBases
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search