SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 stored procedure error???
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

cpwynn
Starting Member

2 Posts

Posted - 07/06/2006 :  14:16:03  Show Profile
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

USA
36949 Posts

Posted - 07/06/2006 :  14:20:00  Show Profile  Visit tkizer's Homepage
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 - 07/06/2006 :  15:01:18  Show Profile
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

USA
36949 Posts

Posted - 07/06/2006 :  15:02:56  Show Profile  Visit tkizer's Homepage
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

India
22755 Posts

Posted - 07/07/2006 :  01:21:18  Show Profile  Send madhivanan a Yahoo! Message
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
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000