Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1112131415»»

wildcards Expand / Collapse
Author
Message
Posted Thursday, September 12, 2013 6:27 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 1:34 PM
Points: 4,049, Visits: 727
I know - the super-secret option Ignore Truncation was set


Post #1494131
Posted Thursday, September 12, 2013 8:11 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Yesterday @ 2:32 AM
Points: 11, Visits: 62
I don't care what the right answer is, but it's nice to know what the [^p] does in the statement.
Post #1494196
Posted Thursday, September 12, 2013 10:34 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, September 15, 2014 11:49 AM
Points: 1,848, Visits: 587
Hugo Kornelis (9/11/2013)
[quote]Hany Helmy (9/11/2013)
I am really amazed of the 16 people (as of now) who got it right!

And to all people who think they need to post to "get their point back" - rubbish! Points are never subtracted for giving an incorrect reply. You didn't lose anything.
(And even if you post a million posts, you still don't get extra points for the "Question of the Day" category).

I am still waiting for the day Steve finally comes to his senses and gets rid of the points system. (Though the idea to subtract points for posting useless rubbish does have a nice ring to it).


Totally agree with you..
Post #1494283
Posted Thursday, September 12, 2013 11:52 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:33 AM
Points: 6,020, Visits: 8,289
L' Eomot Inversé (9/11/2013)
Hugo Kornelis (9/11/2013)
Hany Helmy (9/11/2013)
I am really amazed of the 16 people (as of now) who got it right!

Hope one of them will post a reply explaining how he got the result without throwing an error.


Very easy. Just answer the question the way it is intended: by looking at the code and not copy/paste-ing it.
I saw the subject of the question, saw the question, and concentrated on the wildcards in the LIKE. I never checked the data types of the table.

(Yes, I only answered after the question was already corrected. But that was irrelevant to me - I had completely not looked at the data types anyway).

Come on Hugo, that's just pain silly, why would anyone have looked at the lengths of the data when the type was varchar(50).


It would be silly if I had actually written that. I haven't. What I wrote, multiple times in a (for me) short message, is that I had not looked at the data type.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1494304
Posted Thursday, September 12, 2013 6:47 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 10:15 AM
Points: 7,742, Visits: 9,491
Hugo Kornelis (9/12/2013)[h]
It would be silly if I had actually written that. I haven't. What I wrote, multiple times in a (for me) short message, is that I had not looked at the data type.

Arrgh, sloppy reading by me .
I guess that when you said you looked at the code I thought that the data declarations were part of the code and so subconsciously decided to misread the next bit because if I didn't I would be reading a contradiction.


Tom
Post #1494412
Posted Friday, September 13, 2013 1:01 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Yesterday @ 2:32 AM
Points: 11, Visits: 62
Moderator, please end this topic...
Post #1494472
Posted Monday, September 16, 2013 7:09 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 22, 2014 7:53 AM
Points: 322, Visits: 76
Yeah, my initial thought was "2, if my instance of 2008R2 properly handles regex, we'll see..." So I ran the code and got the error:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.

So I ended up choosing 0, assuming that was the stand-in for an error message. I'unno, maybe it works properly on 2012?

Not saying I deserve a point or anything, I certainly was wrong. I guess I'm just asking: If it's not specified in the question, are we meant to always assume the newest version of SQL Server?
Post #1495060
Posted Monday, September 16, 2013 9:41 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 7:17 AM
Points: 31,080, Visits: 15,526
Drew Copenhaver (9/16/2013)
Yeah, my initial thought was "2, if my instance of 2008R2 properly handles regex, we'll see..." So I ran the code and got the error:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.

So I ended up choosing 0, assuming that was the stand-in for an error message. I'unno, maybe it works properly on 2012?

Not saying I deserve a point or anything, I certainly was wrong. I guess I'm just asking: If it's not specified in the question, are we meant to always assume the newest version of SQL Server?


I'm not sure that's true. I ran this on my R2 instance and it worked. The regex stuff in LIKE should have been there far earlier. I don't have a SS2K or SS2K5 instance handy, but I think it worked then.

Your error is a syntax error, which might be a transcription or cut/paste error.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1495159
Posted Monday, September 16, 2013 10:12 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 22, 2014 7:53 AM
Points: 322, Visits: 76
Steve Jones - SSC Editor (9/16/2013)
Drew Copenhaver (9/16/2013)
Yeah, my initial thought was "2, if my instance of 2008R2 properly handles regex, we'll see..." So I ran the code and got the error:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.

So I ended up choosing 0, assuming that was the stand-in for an error message. I'unno, maybe it works properly on 2012?

Not saying I deserve a point or anything, I certainly was wrong. I guess I'm just asking: If it's not specified in the question, are we meant to always assume the newest version of SQL Server?


I'm not sure that's true. I ran this on my R2 instance and it worked. The regex stuff in LIKE should have been there far earlier. I don't have a SS2K or SS2K5 instance handy, but I think it worked then.

Your error is a syntax error, which might be a transcription or cut/paste error.


My mistake. I don't think it's a syntax or copy past error, though. We've got two servers running different instances of SQL here. I played with the syntax and couldn't get it to work on what I believe is the 2008 box, but it did work on our other server which is running 2005 and it ran with the correct results. I'm stumped. Might just ask our DBA later and see what he thinks.
Post #1495175
Posted Monday, September 16, 2013 11:15 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 10:15 AM
Points: 7,742, Visits: 9,491
Drew Copenhaver (9/16/2013)
Steve Jones - SSC Editor (9/16/2013)
Drew Copenhaver (9/16/2013)
Yeah, my initial thought was "2, if my instance of 2008R2 properly handles regex, we'll see..." So I ran the code and got the error:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.

So I ended up choosing 0, assuming that was the stand-in for an error message. I'unno, maybe it works properly on 2012?

Not saying I deserve a point or anything, I certainly was wrong. I guess I'm just asking: If it's not specified in the question, are we meant to always assume the newest version of SQL Server?


I'm not sure that's true. I ran this on my R2 instance and it worked. The regex stuff in LIKE should have been there far earlier. I don't have a SS2K or SS2K5 instance handy, but I think it worked then.

Your error is a syntax error, which might be a transcription or cut/paste error.


My mistake. I don't think it's a syntax or copy past error, though. We've got two servers running different instances of SQL here. I played with the syntax and couldn't get it to work on what I believe is the 2008 box, but it did work on our other server which is running 2005 and it ran with the correct results. I'm stumped. Might just ask our DBA later and see what he thinks.

Given the line the error was on, it's in the values clause not in the regexp. The ability to specify more than one row in the values clause was not in SQL 2000 or 2005, but is in SQL 2008 (and onwards). That's your syntax error detecded at a comma, which must have occurred running it against 2005 or an earlier version, where the insert statement has invalid syntax. So perhaps you have mistaken the 2005 box for the 2008 box and vice versa?


Tom
Post #1495200
« Prev Topic | Next Topic »

Add to briefcase «««1112131415»»

Permissions Expand / Collapse