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.
| 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 notethe@FK_UserID = 3@NoteID = 5the tableFK_UN_UserID : FK_UN_NoteID : IsDuplicate1 3 False2 4 True3 5 TrueI need to get the value of IsDuplicate where FK_UN_UserID = 3and 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 TrueThere 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 INTDECLARE @NoteID INTSET @FK_UserID = 3SET @NoteID = 5SET @IsDuplicate = (SELECT IsDuplicate FROM User_Notes WHERE FK_UN_UserID = @FK_UserID AND FK_UN_NoteID = @NoteID) -- Is it an admin noteSELECT @IsDuplicate |
 |
|
|
|
|
|