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 2005 Forums
 Transact-SQL (2005)
 I know this is wrong, but cant see the problem

Author  Topic 

texasweb
Starting Member

11 Posts

Posted - 2009-04-14 : 13:37:01
This code:
SET @strString = 'echo 7.0 > '+rtrim(@strLCL_DIR_NA)+'\'+rtrim @strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 10 >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output

SET @strString = 'echo 1 SQLCHAR 0 0 "^^" 0 none >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 2 SQLCHAR 0 50 "^^,^^" 1 PVR_SYS_EMP_ID_NR >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
-- SET @strString = 'echo 3 SQLCHAR 0 50 "^^,^^" 2 PVR_EMP_NA >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
-- EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 3 SQLCHAR 0 25 "^^,^^" 2 LD_CTL_NR >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 4 SQLCHAR 0 10 "^^,^^" 3 NET_POS_VOL_NR >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 5 SQLCHAR 0 20 "^^,^^" 4 LD_SLS_DT >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 6 SQLCHAR 0 24 "^^,^^" 5 AC_LOC_SYS_NR >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 7 SQLCHAR 0 50 "^^,^^" 6 ANR_NR >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 8 SQLCHAR 0 50 "^^,^^" 7 KEY_NR >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 9 SQLCHAR 0 50 "^^,^^" 8 AC_NA_TE >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output
SET @strString = 'echo 10 SQLCHAR 0 5 "^^,^^\r\n" 9 SLS_LED_PRD_STS >> '+rtrim(@strLCL_DIR_NA)+'\'+rtrim(@strFMT_FIL_NA)
EXEC @intResult = master..xp_cmdshell @strString, no_output

casues the last filed to have the AC_NA_TE and "0"'"".

what have i got wrong?
   

- Advertisement -