I have written the following simple SP, but it does not seem to create the file, and when I simply execute it from query anaylser it return null. I have checked the location is write and that the select statement works independantly.
Does anyone have any ideas:
CREATE proc Crystaldump
as
begin
DECLARE @bcpString varchar(250)
SET @bcpString = 'bcp "select * from contract_paymentdate
where datediff(day, payment_date, getdate()) = 0"
'+
'queryout C:\TextFile\contract.txt -t'
EXEC master..xp_cmdshell @bcpString
end
GO
Does anyone have any ideas:
CREATE proc Crystaldump
as
begin
DECLARE @bcpString varchar(250)
SET @bcpString = 'bcp "select * from contract_paymentdate
where datediff(day, payment_date, getdate()) = 0"
'+
'queryout C:\TextFile\contract.txt -t'
EXEC master..xp_cmdshell @bcpString
end
GO