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)
 issue withCAST and CONVERT

Author  Topic 

atlachar123456
Starting Member

33 Posts

Posted - 2011-11-07 : 13:15:45
Hi,
I have a query with update statement
UPDATE #Rpt
SET Productfamily = PD.pt_sp_type_c
FROM #Rpt s
INNER JOIN #ProductDetails PD on PD.pt_sb_type_c = s.CONVERT(VARCHAR(10),productId) --03112011

here pt_sp_type_c and pt_sb_type_c both are varchar(10) and productId is integer

so when i am trying to execute teh query its showing that cannot convert varchar to int..i am changing productId to varchar for that i am using
cast and convert for me its showing incorrect syntax near the keyword convert

whern i use cast s.CAST(productId AS VARCHAR(10)) --here its showing incorrect syntax near keyword AS can anyone come with appropraite answer..



atlaaaaaaaa

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-11-07 : 14:27:45
s.CONVERT(VARCHAR(10),s.productId) --03112011

Go to Top of Page
   

- Advertisement -