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)
 Would this work?

Author  Topic 

g_r_a_robinson
Starting Member

45 Posts

Posted - 2004-02-11 : 00:37:02
I've been trying all day to retrieve a value from a table. This value will determine some outcomes of what my stored procedure does. But for some reason I'm constantly returned a 'false' value whenever I run the following even though I know that the value is true in the corresponding table. Is my syntax wrong or is this even possible:


DECLARE @IsDuplicate NVARCHAR(5);

SET @IsDuplicate = (SELECT IsDuplicate FROM User_Notes WHERE FK_UN_UserID = @FK_UserID AND FK_UN_NoteID = @NoteID) -- Is it an admin note

the

@FK_UserID = 3
@NoteID = 5

the table

FK_UN_UserID : FK_UN_NoteID : IsDuplicate

1 3 False
2 4 True
3 5 True


I need to get the value of IsDuplicate where FK_UN_UserID = 3
and FK_UN_NoteID = 5, the result would give 'true', but its not??

I'm baffled

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-02-11 : 00:56:33
When I run this code it Returns True

There might be something else that you have over looked:



CREATE TABLE User_Notes(FK_UN_UserID INT, FK_UN_NoteID INT, IsDuplicate VARCHAR(5));


INSERT INTO User_Notes VALUES(1,3,'False')
INSERT INTO User_Notes VALUES(2, 4, 'True')
INSERT INTO User_Notes VALUES(3, 5, 'True')

--***********************************************************

DECLARE @IsDuplicate NVARCHAR(5);

DECLARE @FK_UserID INT
DECLARE @NoteID INT

SET @FK_UserID = 3
SET @NoteID = 5

SET @IsDuplicate = (SELECT IsDuplicate FROM User_Notes WHERE FK_UN_UserID = @FK_UserID AND FK_UN_NoteID = @NoteID) -- Is it an admin note

SELECT @IsDuplicate





Go to Top of Page
   

- Advertisement -