dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Execute SQL Task - passing parameter problem - Microsoft SQL Server

This is a discussion on Execute SQL Task - passing parameter problem - Microsoft SQL Server ; I have an Execute SQL Task DECLARE @SERVER VARCHAR(8000) SET @SERVER = ? SELECT COUNT(*) FROM MASTER.DBO.SYSSERVERS WHERE SRVNAME = @SERVER In the Execute SQL Task parameter mapping, I create an INPUT param, set my value to a variable and ...


Home > Database Forum > Microsoft SQL Server > Execute SQL Task - passing parameter problem

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 04-09-2009, 06:06 AM
Database Newbie
 
Join Date: Apr 2009
Posts: 3
Raghav1981 is on a distinguished road
Exclamation Execute SQL Task - passing parameter problem

I have an Execute SQL Task


DECLARE
@SERVER VARCHAR(8000)

SET @SERVER = ?

SELECT COUNT(*) FROM MASTER.DBO.SYSSERVERS WHERE SRVNAME = @SERVER

In the Execute SQL Task parameter mapping, I create an INPUT param,
set my value to a variable and set parameter name to 0.

When Executing the query i get an error "Syntax error, permission violation,
or other nonspecific error"

where as if remove the declared variable and tried with direct query like below

SELECT COUNT(*) FROM MASTER.DBO.SYSSERVERS WHERE SRVNAME = ?

it works exactly fine.

any idea why its not working with declared variable.
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 05:18 AM.