I guess anyone who as a solid web reference or other reference material to creating stored procedures in MS SQL, it would be much appreciated...everything i found is for MySQL and Im finding a lot for the syntax is not the same.
On Sun, Nov 23, 2008 at 2:26 PM, BigJ <[EMAIL PROTECTED]> wrote: > > My procedure code: > > ALTER PROCEDURE dbo.InsertImage > ( > @ImagePath varchar(50), > @UserId varchar(10), > @ImageCnt int > ) > AS > BEGIN > SELECT MAX(ImageCnt) AS MaxImageCnt FROM userImages > WHERE ImagePath LIKE @ImagePath+'%' > > IF MaxImageCnt!=NULL > SET @[EMAIL PROTECTED] > SET @[EMAIL PROTECTED](MaxImageCnt AS varchar) > > INSERT UserImages (ImagePath,UserId,ImageCnt) VALUES > (@ImagePath,@UserId,@ImageCnt) > END > > My question is how do you set a variable to the result of the SELECT > query, which should be in MaxImageCnt. When I try to save this, it > tells me that the compiler is basically trying to find a column caled > MaxImageCnt, which makes sense. I guess this is a completely newie > syntactical issue, but i can't find anything on it. i know there is > also other lopsided bad syntax in this procedure too, but please > ignore that and if possible provide insight to the problem i > asked...thanks guys. > > Jon