New training course: Customizing SQL Prompt. Watch now.

Styles - Are there any Customization Options Possible Beyond what is in the Formatting Styles Dialog

Are there any options (i.e. directly editing the files that save the formatting styles) for making customization's to Formatting styles that are not in the Formatting Styles dialog?

For example if I wanted to Apply a set of multi-line comments after SELECT and before the first set of characters that come after the SELECT and add  1= 1 AND after the WHERE but before the first condition like below.
SELECT /*TraceTag;Code=SampleCodeForSQLPrompt;Version=2020.11.11;[email protected]*/
       Col1,
       Col2,
	   Colx

FROM TABLEA A
WHERE 1 = 1 
  AND A.Col1 = @TestVariable1
  AND A.Col2 = @TestVariable2

In my work we use the tracetag as a search mechanism for determining what is being done when we are monitoring/capturing commands to the server be it via profiler or some other means. The app we use will in this example replace @Appuser with the name of the user who's logged into teh app. When we look at some query tats's been run we know its source because of the tracetag info and because the app will replace @Appuser with the ID of the user we know who is behind the query's execution. We have to do this because at the SQL level everyone access the DB as the dbo user. This is not something we as the customer have any control over. To work around this I embed this tracetag in everything we can customize so when something happens and we can narrow down the query that caused it we can identify who the user is. When your viewing thousands of lines of captured code the tarcetag also makes it much easier to find something when your looking for something specif. 

This may be TMI to answer the Q but I thought it would help some if I explained why we are looking for this customization that might otherwise seem strange to be requesting. 

Thanks

Answers

Sign In or Register to comment.