Click here to Skip to main content
15,895,746 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Gaming Pin
W Balboos, GHB26-Mar-18 0:54
W Balboos, GHB26-Mar-18 0:54 
GeneralThere's an SMBC for that Pin
Jon McKee23-Mar-18 10:38
professionalJon McKee23-Mar-18 10:38 
GeneralRe: There's an SMBC for that Pin
PIEBALDconsult23-Mar-18 13:17
mvePIEBALDconsult23-Mar-18 13:17 
GeneralRe: There's an SMBC for that Pin
Jon McKee23-Mar-18 13:27
professionalJon McKee23-Mar-18 13:27 
GeneralPirate programming Pin
RickZeeland23-Mar-18 9:51
mveRickZeeland23-Mar-18 9:51 
GeneralRe: Pirate programming Pin
H.Brydon25-Mar-18 15:03
professionalH.Brydon25-Mar-18 15:03 
GeneralRe: Pirate programming Pin
RickZeeland25-Mar-18 20:09
mveRickZeeland25-Mar-18 20:09 
GeneralWouldn't it be great... Pin
#realJSOP23-Mar-18 6:52
mve#realJSOP23-Mar-18 6:52 
...if SQL had macro functionality (kinda like C++) that would help reduce the amount of repetitive bullcrap we have to deal with? For instance, this is part of an answer I posted in the C# forum.
SQL
SELECT MIN(substring([ID], PATINDEX('%[0-9]%', [ID]), 1+PATINDEX('%[0-9][^0-9]%', [ID]+'x')-PATINDEX('%[0-9]%', [ID]))) AS MinID,
       MAX(substring([ID], PATINDEX('%[0-9]%', [ID]), 1+PATINDEX('%[0-9][^0-9]%', [ID]+'x')-PATINDEX('%[0-9]%', [ID]))) AS MaxID,
       [Fruit] 
FROM [#fruits] 
GROUP BY [Fruit]


It would really nice if I could create a macro with the contents of the repeated code:

SQL
substring([ID], PATINDEX('%[0-9]%', [ID]), 1+PATINDEX('%[0-9][^0-9]%', [ID]+'x')-PATINDEX('%[0-9]%', [ID]))


Something like this:

SQL
declare @justNumeric MACRO = <substring([ID], PATINDEX('%[0-9]%', [ID]), 1+PATINDEX('%[0-9][^0-9]%', [ID]+'x')-PATINDEX('%[0-9]%', [ID]))>


Which would reduce the first query to this:

SQL
SELECT MIN(@justNumeric) AS MinID,
       MAX(@justNumeric) AS MaxID,
       [Fruit] 
FROM [#fruits] 
GROUP BY [Fruit


This couldn't possibly have an adverse effect on SQL's error reporting incapabilities (Syntax error near ','), so I'm not concerned with that.

Am I just an optimistic dreamer?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013


modified 23-Mar-18 13:01pm.

GeneralRe: Wouldn't it be great... Pin
Stephen Gonzalez23-Mar-18 6:58
Stephen Gonzalez23-Mar-18 6:58 
GeneralRe: Wouldn't it be great... Pin
#realJSOP23-Mar-18 7:02
mve#realJSOP23-Mar-18 7:02 
GeneralRe: Wouldn't it be great... Pin
Stephen Gonzalez23-Mar-18 7:18
Stephen Gonzalez23-Mar-18 7:18 
GeneralRe: Wouldn't it be great... Pin
Don Burton23-Mar-18 7:23
Don Burton23-Mar-18 7:23 
GeneralRe: Wouldn't it be great... PinPopular
Slacker00723-Mar-18 7:25
professionalSlacker00723-Mar-18 7:25 
GeneralRe: Wouldn't it be great... Pin
#realJSOP23-Mar-18 7:46
mve#realJSOP23-Mar-18 7:46 
GeneralRe: Wouldn't it be great... Pin
lopatir23-Mar-18 7:50
lopatir23-Mar-18 7:50 
GeneralRe: Wouldn't it be great... Pin
Stephen Gonzalez23-Mar-18 7:58
Stephen Gonzalez23-Mar-18 7:58 
GeneralRe: Wouldn't it be great... Pin
Jagger B23-Mar-18 13:02
Jagger B23-Mar-18 13:02 
GeneralRe: Wouldn't it be great... Pin
Sandeep Biswha23-Mar-18 15:15
Sandeep Biswha23-Mar-18 15:15 
GeneralRe: Wouldn't it be great... Pin
Single Step Debugger23-Mar-18 12:40
Single Step Debugger23-Mar-18 12:40 
GeneralRe: Wouldn't it be great... Pin
Stephen Gonzalez20-Apr-18 8:54
Stephen Gonzalez20-Apr-18 8:54 
GeneralRe: Wouldn't it be great... Pin
OriginalGriff23-Mar-18 7:25
mveOriginalGriff23-Mar-18 7:25 
GeneralRe: Wouldn't it be great... Pin
#realJSOP23-Mar-18 7:47
mve#realJSOP23-Mar-18 7:47 
GeneralRe: Wouldn't it be great... Pin
Jörgen Andersson23-Mar-18 9:47
professionalJörgen Andersson23-Mar-18 9:47 
GeneralRe: Wouldn't it be great... Pin
Single Step Debugger23-Mar-18 12:43
Single Step Debugger23-Mar-18 12:43 
GeneralRe: Wouldn't it be great... Pin
lopatir23-Mar-18 7:29
lopatir23-Mar-18 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.