SQL Query result show in xml file

I had this question after viewing Help with scripting the SQL and show result.

Dear Expert

After running the query script:
SELECT  *
FROM TableName
WHERE date_colname = GETDATE()

PRINT @@ROWCOUNT

This @@ROWCOUNT will show a number, this number I want it to show in a xml file, this xml need to be create with a random name never mind what. I also want the file show the error if there is any error output.

Please help.
LVL 1
WeTiAsked:
Who is Participating?
 
Mark WillsTopic AdvisorCommented:
Can do quite a lot, really depends on what additional information you need to capture :
select @@ROWCOUNT as [Rowcount] for xml path('RowCounters')

Open in new window

0
 
aikimarkCommented:
Have you tried
Select PRINT @@ROWCOUNT For XML

Open in new window

0
 
louisfrCommented:
What should the xml file look like?
0
 
WeTiAuthor Commented:
I will need to rethink about this and create another question thanks for now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.