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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Syntax error--concatenation

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-13 : 23:59:30
Marc writes "I understand the concatenation character is "+". However the following does compile. Please help. Thank you!!




CREATE PROCEDURE sp_temp @DBN Varchar(50)
AS
DECLARE @FIRSTHALF varchar (40)
DECLARE @SECONDHALF varchar (50)
DECLARE @DATABASE varchar(50)

SET @DATABASE=@DBN
SET @FIRSTHALF='osql /U sa /P /d '
SET @SECONDHALF='/S SERVERNAME /i c:\FileName.sql'

EXEC XP_CmdShell @OSQL + @DATABASE + @SECONDHALF

/*
EXEC should render:

EXEC XP_CmdShell 'osql /U sa /P /d DATABASE VARIABLE /S SERVERNAME /i c:\FileName.sql'
*/"
   

- Advertisement -