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)
 Using restricted words

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2004-11-02 : 06:54:14
I have an exisiting database and a field which can contain REQ, OUT or IN.

I need to construct a stored procedure to select one of these but I am having problems as IN and OUT seem to be reserved words. How can I get round this ? Here's my stored procedure.@strRMUStatus comes from a radiobutton list on my webform

@strRMURequestNo int,
@strRMUStatus integer

AS


If @strRMUStatus = 1
BEGIN

SELECT * from vwetblFiles

WHERE vwetblFiles.MovementId = @strRMURequestNo
and vwetblFiles.Status =N'REQ'
END



If @strRMUStatus = 2
BEGIN

SELECT * from vwetblFiles

WHERE vwetblFiles.MovementId = @strRMURequestNo
and vwetblFiles.Status = N'OUT'
END


If @strRMUStatus =3

BEGIN

SELECT * from vwetblFiles

WHERE vwetblFiles.MovementId = @strRMURequestNo
and vwetblFiles.Status =N' IN'
END
GO

nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-02 : 07:08:47
What's wrong with it?


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2004-11-02 : 07:09:10
Resolved
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2004-11-02 : 07:11:11
Space after the quote 'IN' - how embarassing !
Go to Top of Page
   

- Advertisement -