November 11, 2008 at 2:59 pm
when i run this stored procedure error is:
Conversion failed when converting the nvarchar value 'A' to data type int.
select A.Account_number, A.Customer_name, A.Known_As, A.Legacy_Account_Number, A.Account_Established_Date, CASE WHEN A.Customer_Status = 'I' THEN CAST ('0' AS int) ELSE CAST ('1' AS int) END, A.Account_Established_Date
from
dbo.AVW_11i_WA_BILLTO_Customers A
left outer join dbo.Customers C
on A.Account_number = C.CustomerID
where
C.CustomerID is null
GO
November 11, 2008 at 6:58 pm
Is A.Account_Number an NVarchar()? If so then you should CAST C.Customer_ID to NVarchar() in your ON clause.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
November 11, 2008 at 7:17 pm
Try this:
select A.Account_number, A.Customer_name, A.Known_As,
A.Legacy_Account_Number, A.Account_Established_Date,
CASE A.Customer_Status
WHEN 'I' THEN 0
ELSE 1
END,
A.Account_Established_Date
from
dbo.BILL_TO_Customers A
left outer join dbo.Customers C
on A.Account_number = C.CustomerID
where
C.CustomerID is null
November 11, 2008 at 9:05 pm
it works but error is:
Conversion failed when converting the nvarchar value 'A' to data type int
November 11, 2008 at 9:15 pm
This is actually a continuation of the following thread:
http://www.sqlservercentral.com/Forums/Topic600148-338-5.aspx#bm601093
November 11, 2008 at 9:46 pm
paul.starr (11/11/2008)
it works but error is:Conversion failed when converting the nvarchar value 'A' to data type int
So... what do you think an 'A' should convert to when converting to an INT? Or do you just want to ignore it?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 11, 2008 at 9:56 pm
If it is an 'I' then 0 else 1.
Jeff, been try to help him, but we can't even get him to help himself. I have pointed him toward your article on how to ask for help many times, but he just doesn't seem to get it.
November 11, 2008 at 9:58 pm
I used a CAST function for the value
Case When A.Customer_Status = 'I' THEN CAST ('0' AS int) ELSE CAST('1' AS int) END
So status in the table should be updated to 1 if the value in the view is A, if it is I then it will update to 0
November 11, 2008 at 10:03 pm
Lynn the create table statement was wrong, what about the datatypes, and how many value lines do you need
November 11, 2008 at 10:11 pm
paul.starr (11/11/2008)
Lynn the create table statement was wrong, what about the datatypes, and how many value lines do you need
I've told you what I need. You need to read and follow the guidelines presented in the article below to help us help you. Nothing more, nothing less.
November 11, 2008 at 11:38 pm
Lynn Pettis (11/11/2008)
If it is an 'I' then 0 else 1.Jeff, been try to help him, but we can't even get him to help himself. I have pointed him toward your article on how to ask for help many times, but he just doesn't seem to get it.
Yep... thought I'd give it one more try. I'm moving on...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply