What are the challenges you face when working across database platforms? Take the survey

Snippet Manager - Custom Placeholder

I have a question, but it's listed at the bottom, want to give an explanation first.

I'm a big fan of using the $PASTE$ placeholder when creating snippets. Typically I use them for Date formatting, example below:

Snippet Code examples:

So with a sample SQL query of
SELECT abc.Date 
FROM DB..Alphabet abc

I would cut (CTRL+X) 'abc.Date' and insert the snippet, with 'abc.date' being inserted in the $PASTE$ sections. Example result would be:
SELECT CONVERT(VARCHAR, abc.Date , 101) AS abc.Date 
FROM DB..Alphabet abc

It works great, except then I have to go remove the alias from the column name portion.

SO here's my question

Is there a way to create a custom placeholder, that basically works the same way as $PASTE$, but recognizes there's a table alias attached and removes it? i.e.

CONVERT(VARCHAR, $PASTE$, 101) AS $customPASTE$ = CONVERT(VARCHAR, abc.Date, 101) AS Date


Sign In or Register to comment.