September 4, 2013 at 7:47 am
I've been given a script that is similar to following. This script is saved out to a network share and called from a SQL job using sqlcmd. I am not at all familiar with sqlcmd and this :XML ON (also this :OUT command). What I ultimately need to do, is dynamically change the file name and append the date to it. Here is a modified version of the script:
Use [DB1]
GO
:XML ON
:OUT \\fileserv1\customer\XML\getCompScores.xml
SELECT
loginname
,substring(convert(VARCHAR, grade), 1, 4) AS 'Grade'
,date_submitted
FROM OrganizationLogin
AND convert(VARCHAR, date_submitted, 101) = CONVERT(DATE, DATEADD(DD,-1,GETDATE()))
FOR XML raw
,root('Accounts')
,elements
GO
:out stdout
:XML Off
Like I mentioned previously, I just need to be able to dynamically change getCompScores.xml to be getCompScores_20130903.xml.
Any and and all help will be greatly appreciated.
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply