Server Help

Trash Talk - Stupid MSSQL error

Animate Dreams - Sat Dec 01, 2007 12:58 pm
Post subject: Stupid MSSQL error
So I'm trying to create this procedure for a school assignment(that was due probably 5 weeks ago) thatI believe would work in Oracle, which is what they're using in this book to explain how to make procedures. Here it is

Code: Show/Hide
CREATE PROCEDURE PROC1(T_NUM IN INTEGER)
BEGIN
    SELECT * FROM TRUCK
    WHERE TRUCK_NUM = T_NUM
END;


But MSSQL gives me this error:

Server: Msg 170, Level 15, State 1, Procedure PROC1, Line 1
Line 1: Incorrect syntax near 'T_NUM'.

I don't expect many of you have had any experience with MSSQL, but if you have and know wtf the syntax error is, please tell me. I've already tried google.
Animate Dreams - Sat Dec 01, 2007 1:47 pm
Post subject:
Okay, I eventually got it after talking with some dude who apparently doesn't know SQL.

Code: Show/Hide
CREATE PROCEDURE PROC1(@T_NUM INTEGER) AS
BEGIN
    SELECT * FROM TRUCK
    WHERE TRUCK_NUM = @T_NUM
END;


Why it needed @s, and more specifically, why it wouldn't work with IN declared, I don't know.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group