Knowledge Base

Document information

Document ID:5204
Subject:Special Comments in WinSQL
Creation date:3/16/18 11:28 AM
Last modified on:3/16/18 11:28 AM


WinSQL Special Comments

WinSQL supports several comments that are meant to enhance the functionality of queries you write. This page lists those comments. All of these comments are Line Comments. In other words, they start with two dashes.

For Example
-- wn_SaveToCSV C:\Temp\Customer.csv select * from Customer where state = 'NJ'

Important!

You must run queries in Grid to use the special comments


Available Comments

CommentDescription
-- wn_NamedQuery Specifies a name for a Named Query. This value is useful when you try to save a named query.
-- wn_SaveToCSV Saves the results of a SELECT query to a text file in CSV format. This comments takes a file name as parameter representing the path for the output file.

For Example
-- wn_SaveToCSV C:\Temp\Customer.csv select FirstName, LastName, sum(Cost) as TotalOrderValue from Customer INNERT JOIN Orders ON Customer.ID = Orders.ID where state = 'NJ'


-- wn_SaveToHTM Similar to CSV, this comment saves the output of a SELECT query to a HTML file.
For Example
-- wn_SaveToHTM C:\Temp\Sample.htm select FirstName, LastName, sum(Cost) as TotalOrderValue from Customer INNERT JOIN Orders ON Customer.ID = Orders.ID where state = 'NJ'
You can optionally change the style sheet used by WinSQL when exporting to HTML. This done by modifying htmlHead.txt file in the DataFolder
-- wn_ShowColumnInfo Displays the metadata for a SELECT query.
For Example
-- wn_ShowColumnInfo select * from dbo.Customer c where Dop >= GetDate() - 1
-- wn_TabTitle This is a convenient way to specify a title for the tab in the grid. This becomes useful if you need to save the contents of a result grid.
For Example
-- wn_TabTitle One Day Cust select * from dbo.Customer c where Dop >= GetDate() - 1


User comments

Posted by George Soulis on 9/21/18 2:03 AM

I just found out about these special comments and I think it's a great idea. I just hope they were not only working when the query is run in grid mode. It would be very nice if "wn_TabTitle" could be used in text mode to give the query results a title.


Add a comment to this document

Do you have a helpful tip related to this document that you'd like to share with other users? Please add it below. Your name and tip will appear at the end of the document text.
Your name:
Your email:
Hide my email address
Verification code:
Enter the verification code you see above more submitting your tip
Tip:Please limit tips to 1000 characters

Navigation

Social Media

Powered by 10MinutesWeb.com