March 21, 2018 at 6:54 am
Hi All,
New to SQL server Management studio and trying to build basic query to extract some data. Below is query and error message I get. I know Project filed is varchar and that is why I placed single quote in where condition value. Same result even if I have no quotes or double quotes. Any help is truly appreciated.- Thank you.
SELECT
[glNumber]
,[fund]
,[department]
,[account]
,[project]
,[inactive]
FROM [D014Glwa].[dbo].[GL_GeneralLedger]
where dbo.GL_GeneralLedger.project = 'CENT01';
Error message: Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'SD8040' to data type int.
March 21, 2018 at 6:58 am
patelvoct - Wednesday, March 21, 2018 6:54 AMHi All,
New to SQL server Management studio and trying to build basic query to extract some data. Below is query and error message I get. I know Project filed is varchar and that is why I placed single quote in where condition value. Same result even if I have no quotes or double quotes. Any help is truly appreciated.- Thank you.
SELECT
[glNumber]
,[fund]
,[department]
,[account]
,[project]
,[inactive]
FROM [D014Glwa].[dbo].[GL_GeneralLedger]
where dbo.GL_GeneralLedger.project = 'CENT01';Error message: Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'SD8040' to data type int.
I see nothing in that query which would generate that error. Is [D014Glwa].[dbo].[GL_GeneralLedger] a view, rather than a table?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 21, 2018 at 7:54 am
Hi Phil- Thank you for your prompt response. GL_GeneralLedger is a table not a view. I am not sure either on what to try. Not sure about the CAST function to force conversion to Varchar for the same
statement. Any thoughts? Thank you once again- VJP
March 21, 2018 at 8:00 am
patelvoct - Wednesday, March 21, 2018 6:54 AMHi All,
New to SQL server Management studio and trying to build basic query to extract some data. Below is query and error message I get. I know Project filed is varchar and that is why I placed single quote in where condition value. Same result even if I have no quotes or double quotes. Any help is truly appreciated.- Thank you.
SELECT
[glNumber]
,[fund]
,[department]
,[account]
,[project]
,[inactive]
FROM [D014Glwa].[dbo].[GL_GeneralLedger]
where dbo.GL_GeneralLedger.project = 'CENT01';Error message: Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'SD8040' to data type int.
Do you get the same error if you run the select without the WHERE clause?
March 21, 2018 at 8:30 am
Hi Lynn,
It works great without the where clause. I need to have where clause for multiple condition once I resolve or know how to resolve the issue. 🙂
Thank you
VJP
March 21, 2018 at 8:36 am
patelvoct - Wednesday, March 21, 2018 8:30 AMHi Lynn,
It works great without the where clause. I need to have where clause for multiple condition once I resolve or know how to resolve the issue. 🙂
Thank you
VJP
This suggests that the Project column is not varchar after all. Can you post the DDL (CREATE script) for the GL_GeneralLedger table?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 26, 2018 at 10:53 pm
This was removed by the editor as SPAM
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply