Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter of the type integer in a sp

Status
Not open for further replies.

INFORMAT

Programmer
Jan 3, 2001
121
BE
I have a problem when I want to use a parameter of the type integer in the where clausule of my select commando.

WHERE afdboek.p_afdjaar = '+@parnextafdjaar

the parameter -> @parnextafdjaar is of the type integer.

When I want to execute this sp, an error is given

Server: Msg 207, Level 16, State 3, Line 0'
'Invalid column name 'h'


in the query, the column name 'h' is mentionned.
the error vanishes when I replace the parameter with a value (for example : 360)

could someone help me with this problem?

Björn, programmer >:):O>

 
Try following:

'WHERE afdboek.p_afdjaar = ' + convert(varchar(12), @parnextafdjaar)

Hope this helps.
Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
I've tried that, but it didn't work,
but thanks

bjorn :cool:
 
Error about "h" is not related to the integer value converting to string, it might be somewhere else. Post a complete code here to get more help...
Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
I've found a sollution
convert the integer parameter into a varchar parameter
and work with this new parameter

DECLARE @inschr varchar(20)
SET @inschr = CAST(@parinschr AS varchar(20))

thanks for the help

björn >:):O>
 
convert() function does the same...
Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top