Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 stord procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-16 : 09:46:59
Maximilan writes "Hi,

I'm an italian programmer with only few experience in Sql
and would like to know if the following Stored Procedure
Is executable.

Thank u for Your help!
Greetings from Italy ... IL PAESE DEL SOLE !!! (translated: The country of sun !!!)


CREATE PROCEDURE SelGen (@Campo varchar ,@Riga integer, @Return varchar out)
AS
BEGIN
SELECT @Campo from Categories where
@Campo = @Riga
END
return @Return "

mr_mist
Grunnio

1870 Posts

Posted - 2003-05-16 : 10:29:34
I'm not sure what you are trying to do here. A few things occurr to me..

First, you're trying to read a column (@campo). If you're trying to read from a dynamically chosen column,you can't do it this way, you'll need to use dynamic sql instead. If you're trying to put the value of a column into @campo, you need to do

select @camp = yourcolumnname from categories

Second, you are checking that @campo = @rigo, and the datatypes are not the same. You may get away with it if @campo always happens to be an integer, but why take that chance?

What are you trying to do?

-------
Moo.
Go to Top of Page

ToddV
Posting Yak Master

218 Posts

Posted - 2003-05-16 : 10:31:12
Maximilan,

This porocedure will not work, but I think it is close. It is just not quite clear what your objective is. Please elaborate.



Go to Top of Page
   

- Advertisement -