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 2005 Forums
 Transact-SQL (2005)
 Mismatch on Query after update to sql2k5

Author  Topic 

Laney Dale
Starting Member

2 Posts

Posted - 2007-08-30 : 09:37:52
Hi,
I have a webpage that updates a table. It worked fine till I upgraded to SQL 2005. I think I have figured out that it is a mismatch in the where statement. It compares a bigint id field to a variable on the page.
I think I need to cast the variable, just am not familiar wit this. Can anyone help?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-30 : 09:39:01
Without seeing the query nor code?
Not me.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Laney Dale
Starting Member

2 Posts

Posted - 2007-08-30 : 13:27:01
My apologies,
The update reads
Update Tablename
Set Field1 = 'variable'
Where FieldRecordID = 'variable'

I am sure I am gettign this because FieldRecordID is a bigint field, as I started encountering this in other areas for the same reason. I used a work around that I cannot use here. Any suggestions?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-30 : 13:42:36
DECLARE @Var1 INT, @Var2 VARCHAR(30)

UPDATE Tablename
SET Field1 = @Var2
WHERE FieldRecordID = @Var1

works for me...



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -