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 |
Yonkouturko
Yak Posting Veteran
59 Posts |
Posted - 2013-09-12 : 04:01:23
|
DECLARE @datetoday AS varchar(max) set @datetoday = CONVERT(VARCHAR(10), getdate(), 111)SELECT ReferenceNumber AS REFERENCENUMBER, DATEDIFF(D, (SELECT TOP (1) MODIFIED_DATE FROM Table_customer_record_expected_service WHERE (C_ID = Table_Customer_Records.ID) ORDER BY ID DESC), @datetoday) AS [Last Days of Transaction], Company_Name AS [COMPANY NAME], Contact_Person AS [CONTACT PERSON], Email_Address AS EMAIL, Line_of_Business AS [LINE OF BUSINESS], Telephone_No AS TELEPHONE, Mobile_No AS MOBILE, Fax_No AS FAX, Address AS ADDRESS, Area AS AREA, Website AS WEBSITE, Priority_Level AS PRIORITY, (SELECT TOP (1) MODIFIED_DATE FROM Table_customer_record_expected_service WHERE (C_ID = Table_Customer_Records.ID) ORDER BY ID DESC) AS [LAST DATE CALLED], (SELECT TOP (1) DATE_RECEIVED FROM Table_JobOrder_Information WHERE (C_ID = Table_Customer_Records.ID) ORDER BY ID DESC) AS [LAST DATE OF TECHNICAL SERVICE], IDFROM Table_Customer_RecordsC_ID and Table_Customer_Records.ID are both bigint...in data type....this query error says "Error converting data type varchar to bigint."i don't know whats happening |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-09-12 : 09:14:05
|
If they are indeed bigints, then it should not throw that error. Verify that it is so by running this query and a similar one for C_ID (or looking up in SSMS object explorer)SELECT OBJECT_NAME(Object_id),c.name AS ColumName, t.name AS DataTypeFROM sys.columns c INNER JOIN sys.types t ON t.system_type_id = c.system_type_idWHERE OBJECT_NAME(Object_id) = 'Table_Customer_Records'AND c.name = 'ID' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-12 : 16:02:07
|
may be one of columns are having some nonnumeric data.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|