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
 Old Forums
 CLOSED - General SQL Server
 stored procedure error???

Author  Topic 

cpwynn
Starting Member

2 Posts

Posted - 2006-07-06 : 14:16:03
Heres my procedure:

CREATE PROCEDURE dbo.zzBlock
@fileName varchar (255),
@data int
AS
INSERT INTO dbo.ZZHLPDocInformation (docInfoBlocked)
VALUES (@data)
WHERE (docInfoDocFilename = @fileName)
GO


I want to insert a variable (@data) into the docInfoBlocked column, where the filename is @filename.... I get a syntax error near WHERE.... any suggestions????

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-07-06 : 14:20:00
Perhaps what you want is an update:

UPDATE dbo.ZZHLPDocInformation
SET docInfoBlocked = @data
WHERE docInfoDocFilename = @fileName


Tara Kizer
aka tduggan
Go to Top of Page

cpwynn
Starting Member

2 Posts

Posted - 2006-07-06 : 15:01:18
Thanks!!!! works like a charm... one more question... what do i do since its the column accepts the 'bit' datatype... i either want the value to be 1 or null??? how do i input a null value for @data???? (NOTE: im using ASP)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-07-06 : 15:02:56
If the column is bit, then you need to define @data as bit. If you want @data to be NULL, then pass in a NULL from your application.

But maybe I don't understand your question.

Tara Kizer
aka tduggan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-07 : 01:21:18
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -