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 12»»

Get Away From Confusing Code Expand / Collapse
Author
Message
Posted Wednesday, October 12, 2005 4:37 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, December 2, 2014 9:23 PM
Points: 320, Visits: 363
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/sMcCown/getawayfromconfusingcode.asp

Watch my free SQL Server Tutorials at:
http://MidnightDBA.ITBookworm.com

Read my book reviews at:
www.ITBookworm.com

Blog Author of:
Database Underground -- http://www.infoworld.com/blogs/sean-mccown
DBA Rant – http://dbarant.blogspot.com
Post #228488
Posted Tuesday, November 15, 2005 2:39 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, June 24, 2007 2:53 AM
Points: 28, Visits: 1
Thanx.
I like this approach. Very simple, but I didn't even think in this way.
Post #237080
Posted Tuesday, November 15, 2005 3:36 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 7:42 AM
Points: 47, Visits: 96
Nice simple idea that make a lot of sense - thanks
Post #237101
Posted Tuesday, November 15, 2005 6:22 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, November 7, 2014 9:20 AM
Points: 2,555, Visits: 607
Great "thinking outside the box" Sean - I know that I personally hate parantheses as much as I hate the single/double quotes - especially in really lengthy expressions...going to try that out with ascii as well...got to think of a really meaningful variable name though - I knew that 'SQ' was single quote but I'm so used to looking at phrases with SQL in it that I had to keep reminding myself that this was not 'truncated SQL'!!







**ASCII stupid question, get a stupid ANSI !!!**
Post #237145
Posted Tuesday, November 15, 2005 7:19 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, June 12, 2014 2:58 PM
Points: 92, Visits: 170

Great approach and very easy to implement - good job!

 

Post #237171
Posted Tuesday, November 15, 2005 7:28 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, August 20, 2013 2:05 PM
Points: 308, Visits: 55

Such a simple idea. Gotta love it.




Bob
SuccessWare Software
Post #237175
Posted Tuesday, November 15, 2005 7:36 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, September 11, 2012 1:44 PM
Points: 277, Visits: 16
This is a webby site with ASCII information.
http://www.lookuptables.com/

Thanks and have a great day.
RN
Post #237179
Posted Tuesday, November 15, 2005 8:06 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, April 4, 2012 9:22 PM
Points: 102, Visits: 9

I like the idea of using variables instead of the quotes.  But not the part about the ASCII characters.  The solution below works best for me:

Declare @q char(1)
Set @q = ''''

The value in the Set statement is four (4) characters, all single quotes.


 




Regards,

Bob Monahon
Post #237194
Posted Tuesday, November 15, 2005 8:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 11, 2014 12:32 PM
Points: 8, Visits: 65

Good article, but it makes me yearn all the more for database-global constants (they don't have them in 2000, I wonder if they're in 2005...)

 

Post #237195
Posted Tuesday, November 15, 2005 10:12 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 5, 2012 12:03 PM
Points: 117, Visits: 163
You could also look at QuoteName()

DECLARE @quote Char(1)
SET @quote = ''''

PRINT 'WHERE LastName = ' + QuoteName( @LName, @quote )
PRINT 'WHERE TDate = ' + QuoteName( GetDate(), @quote )
PRINT 'WHERE LDate = ' + QuoteName( GetDate() - 100, @quote )
Post #237259
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse