Highlighted

[Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'column_name'

New Here ,
Sep 16, 2015

Copy link to clipboard

Copied

1. In my ColdFusion 11 website (with SQL Server 2008 R2), the following cfquery is throwing the above error:

<cfquery name="deleteGrantModificationItems" datasource="#dsource#">

DELETE col_key FROM myTable

WHERE col_key = <cfqueryPARAM value = "#appkey#" CFSQLType = "CF_SQL_VARCHAR">

</cfquery>

2. When I run the sql profiler to capture the query, I get:

eclare @p1 int

et @p1=NULL

exec sp_prepexec @p1 output,N'@P1 varchar(8000)',N'DELETE col_key FROM myTable

WHERE col_key = @P1 ','000000001644'

select @p1

3. when I run the above in the Query Analyzer, I get the following error:

Msg 208, Level 16, State 1, Line 1

Invalid object name 'col_key'.

Msg 8180, Level 16, State 1, Procedure sp_prepexec, Line 1

Statement(s) could not be prepared.

What could be the issue? Please help.

Views

566

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

[Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'column_name'

New Here ,
Sep 16, 2015

Copy link to clipboard

Copied

1. In my ColdFusion 11 website (with SQL Server 2008 R2), the following cfquery is throwing the above error:

<cfquery name="deleteGrantModificationItems" datasource="#dsource#">

DELETE col_key FROM myTable

WHERE col_key = <cfqueryPARAM value = "#appkey#" CFSQLType = "CF_SQL_VARCHAR">

</cfquery>

2. When I run the sql profiler to capture the query, I get:

eclare @p1 int

et @p1=NULL

exec sp_prepexec @p1 output,N'@P1 varchar(8000)',N'DELETE col_key FROM myTable

WHERE col_key = @P1 ','000000001644'

select @p1

3. when I run the above in the Query Analyzer, I get the following error:

Msg 208, Level 16, State 1, Line 1

Invalid object name 'col_key'.

Msg 8180, Level 16, State 1, Procedure sp_prepexec, Line 1

Statement(s) could not be prepared.

What could be the issue? Please help.

Views

567

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 16, 2015 0
haxtbh LATEST
Advocate ,
Sep 17, 2015

Copy link to clipboard

Copied

Your SQL is incorrect.

The statement should just be

DELETE FROM myTable

WHERE col_key = <cfqueryPARAM value = "#appkey#" CFSQLType = "CF_SQL_VARCHAR">

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 17, 2015 0