Forum Replies Created

Viewing 15 posts - 4,996 through 5,010 (of 8,731 total)

  • RE: SQL optimization

    As that's a local temp table, couldn't you avoid inserting those rows in the first place? You would save time inserting and deleting.

    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: String Manipulation

    And another solution using nested REPLACE.

    WITH PartialNames AS (

    SELECT * FROM (VALUES('first,,'),('first,,last'),(',middle,last')) d (PartialName)

    )

    SELECT REPLACE( REPLACE( RTRIM( LTRIM( REPLACE( PartialName, ',', ' '))), ' ', ','), ',,', ',')

    FROM PartialNames

    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: String Manipulation

    This might be more work for the engine but I was having some fun with the DelimitedSplit8k splitter.

    WITH PartialNames AS (

    SELECT * FROM (VALUES('first,,'),('first,,last'),(',middle,last')) d (PartialName)

    )

    SELECT

    STUFF((SELECT ',' + item...

    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: Get the splitted column using fucntion

    serg-52 (4/22/2015)


    Luis Cazares (4/22/2015)


    Your function is missing the ORDER BY at the end. It might seem to return the correct results but it might fail at any time.

    Thank you, Luis....

    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: Transpose Rows to columns

    Put the COUNT outside the CASE.

    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: Get the splitted column using fucntion

    Your function is missing the ORDER BY at the end. It might seem to return the correct results but it might fail at any time.

    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: Insert DATE --Confused with convert

    Just wanted to note that in SQL Server 2008 there's the DATE data type which won't include time. For hire dates it seems a better option.

    Check the different Date and...

    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: Migrating oracle queries to SQL server.

    This can be done with a recursive CTE. You can find many examples on the internet.

    It should be something like this:

    WITH RCTE AS(

    select T1.a1, T1.a2, T1.a3,

    T2.b1,...

    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: Find double records within DateTime range

    This is a possibility using the Quirky Update.

    CREATE TABLE #TEMP (ID int PRIMARY KEY, DateCreated datetime, IsDoubleLag bit)

    INSERT INTO #TEMP VALUES (1,'2015-01-01 08:11:40.490','0')

    INSERT INTO #TEMP VALUES (2,'2015-01-04 02:29:47.777','1')

    INSERT INTO #TEMP...

    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: Where clause question

    This is another option.

    WITH Conditions AS(

    SELECT ORGN, BDOB, TM_PERD

    FROM (VALUES('A1', 'B1', 'C1'),

    ...

    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 someone give me tips on how to use the cast function to display words?

    karodhill (4/14/2015)


    i will certainly check that out but the requirement was to experiment with the cast function so i will keep trying thankyou

    CAST is very simple :-). You'll have more...

    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: Find double records within DateTime range

    Would you be comfortable using the Quirky Update? http://www.sqlservercentral.com/articles/T-SQL/68467/

    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: string query help

    Eirikur Eiriksson (4/14/2015)


    Luis Cazares (4/13/2015)


    cooljagadeesh (4/13/2015)


    thanks boss

    Do you understand the solution that Eirikur provided? There's at least one question that I'd ask.

    Don't be shy Luis, you can ask:-D

    😎

    I know, but...

    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 someone give me tips on how to use the cast function to display words?

    The magic is in the REPLACE() which will implicitly convert the number into a string when it receives the data. Other string functions such as LEFT(), RIGHT(), LEN() and others...

    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: Stopping TSQL loop at will while preserving successful changes

    sql-lover (4/14/2015)


    Hmmm .... thinking loud and to myself.

    I still would like to hear any advice but I think I can't rollback DDL statements in TSQL. In other words, and after...

    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 - 4,996 through 5,010 (of 8,731 total)