Hi Everyone
I created a stored procedure, what I want it to do is use a random generated number and use that as the name for a file that I will be exporting to a file.
Here's what I have conceptually:
Is this the correct way? or is there a better way to do this?
I created a stored procedure, what I want it to do is use a random generated number and use that as the name for a file that I will be exporting to a file.
Here's what I have conceptually:
Code:
...
SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )
as daRandomNumber
EXEC master..xp_cmdshell 'bcp "SELECT * FROM myRecords" queryout c:\' + daRandomNumber + ' -c '
Is this the correct way? or is there a better way to do this?