Forum Replies Created

Viewing 15 posts - 7,321 through 7,335 (of 8,731 total)

  • RE: SYNTAX Help please...

    ScottPletcher (12/18/2013)


    Better to avoid ISNULL, since you should never use it in a WHERE clause. I also think that exactly what's being tested is clearer.

    IF (@category IS NULL OR...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need help in SP

    Sean Lange (12/18/2013)


    You don't need all the extra variables and such in these calculations either. Everything is based off getdate() so there is no need to store interim values. This...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Substring with patindex

    Lowell,

    Would it be possible to make your function perform better by converting it to an iTVF?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: need help on design of database for student registration system

    This might help you as a guide:

    http://www.sqlservercentral.com/stairway/72400/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Substring with patindex

    It won't work with 5 columns. I suggest to use a character-delimited string splitter[/url] and then convert rows to columns using CROSS TABS[/url]

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Substring with patindex

    I'm not really sure about this approach, but it's an option 😉

    SELECT SUBSTRING( PARSENAME( REPLACE( string, '-', '.'), 4), PATINDEX( '%[^0]%', PARSENAME( REPLACE( string, '-', '.'), 4)), 100),

    SUBSTRING( PARSENAME( REPLACE(...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Looking for a Sr. SQL DBA out of SF

    I'd be open to a position in Mexico as I'm already here 😀

    Depending on what it is about.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Return Parent Record value from child records

    A recursive CTE can do the trick in here.

    WITH SampleData(BATCHNUMBER, ID, ORIGINATINGBATCHID) AS( SELECT

    '7803', '8742FDDF-E50A-405B-8567-C69B70E1F110', NULL UNION ALL SELECT

    '7803EXP1', '0DA8CC6E-9B51-4380-835A-331D1B34192F', '8742FDDF-E50A-405B-8567-C69B70E1F110' UNION ALL SELECT

    '7803EXP2', 'F6DE105E-F8EE-40C8-AFA0-67606F7EBA7C', '0DA8CC6E-9B51-4380-835A-331D1B34192F' UNION ALL SELECT

    '7803EXP3',...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Pivot

    Hi, welcome to the forums. This should be made on the application layer, but here's an option. It first unpivots the data with this method: http://www.sqlservercentral.com/articles/CROSS+APPLY+VALUES+UNPIVOT/91234/

    And then I used a...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    wolfkillj (12/17/2013)


    Since SQL Saturday #272 was mentioned in the SSC e-mail newsletter today, I thought I'd mention that I'll be presenting there.

    (My session is based on a similar session...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Help with updating records in a column.

    As far as I understand, it should be more like this to keep the "prod" at the end of the name.

    UPDATE TA

    SET ServerName = STUFF(ServerName,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to avoid repeating same column value every rows

    I do believe that doing it in the aplication layer is the best option. If you really need it on SQL Server, here's an option:

    WITH SampleData(Client, company, division, active) AS(

    SELECT...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Help Making a Query- URGENT

    Mr. Kapsicum (12/17/2013)


    can any one suggest how to do this by Recursive CTE.?

    Why would you want to loose performance instead of using a nice and clear method? 😀

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: can't trap error

    Keith Tate (12/16/2013)


    Since you are on 2012 you should use the TRY...CATCH blocks:

    Mind reading? 😀

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: can't trap error

    I'm sure that this is an example, but it wont hurt to remind you that table variables aren't affected by transactions. 😉

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 7,321 through 7,335 (of 8,731 total)