Forum Replies Created

Viewing 15 posts - 4,951 through 4,965 (of 8,731 total)

  • RE: Grab OrderID

    Steve Jones - SSC Editor (5/12/2015)


    If the ~ is always at the end, you can start a second PATINDEX/CHARINDEX search after the place where you find the first one 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: Split Numbers

    A pattern splitter can help you with this and I hope that you can complete the solution.

    Reference: http://www.sqlservercentral.com/articles/String+Manipulation/94365/

    Select *

    from #tbl_data

    CROSS APPLY (SELECT TOP 1 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: coalesce function in SSIS

    Keith Mescha (5/12/2015)


    How about REPLACENULL( «expression», «expression» )

    REPLACENULL() was introduced with SSIS 2012 and this is a 2005 forum. I still wonder why it took so long to include 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: LIKE with Numeric values

    I'm not sure how Alvin's query solved the problem as the LIKE operator will implicitly convert values into strings.

    DECLARE @test-2 TABLE(

    Numbers int)

    INSERT INTO @test-2 VALUES(12),(75924),(75),(53756),(2354)

    SELECT Numbers

    ...

    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: Month name and year in sql

    I agree with Sean, formatting in the front end will help you with order and more format functions.

    However, here's a shorter way to do it.

    SELECT STUFF( CONVERT( char(11), GETDATE(), 0),...

    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: Bug with IN?

    nycdotnet (5/12/2015)


    CELKO (5/11/2015)


    Perhaps you would like to actually learn SQL before you post?

    Ouch! Nevermind.

    Or you could continue to post more questions to learn more about SQL, even if...

    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: rewriting below query

    Please provide DDL, sample data and expected results based on that sample data.

    Check the following article to help you with the correct way to do it: http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    It's not an unbreakable...

    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: Bug with IN?

    nycdotnet (5/11/2015)


    That's interesting. If I run this with execution plans turned on it does indeed do a clustered index scan with ID as the predicate from #TEST_A and do...

    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 move a procedure from master to another DB using T-SQL

    That's because you're executing the following in the dynamic code.

    USE SomeDB;

    CREATE PROCEDURE usp_Something

    AS

    ...

    As the error states, the CREATE (or ALTER) statement should be the first (and only) statement in 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: How to extract part of a string?

    The best option is to store your full order number in separate columns so you don't have to worry about dividing it later (it's easier to join for presentation than...

    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 move a procedure from master to another DB using T-SQL

    What's not working? Why aren't you using parameters to execute sp_executesql? Why aren't you executing the dynamic code or at least printing it?

    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: SELECT on column name from query's result set in same query?

    From what I understood, you don't need recursion or even a CTE. You're trying to unpivot your data to get an EVA model which might be a very bad idea...

    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?

    SQLRNNR (5/8/2015)


    Lynn Pettis (5/8/2015)


    Geez, now someone doesn't even understand that the code they are running generates and runs dynamic SQL.

    What is dynamic sql?

    What is sql?

    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: TSQL select - replace a result value based on value of another field

    Oracle NVL2() function would be great for this.

    But since we don't have that functionality in SQL Server, IIF() presented by Phil or a classic CASE statement would do the job.

    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: Are the posted questions getting worse?

    Ed Wagner (5/7/2015)


    Luis Cazares (5/7/2015)


    Lynn Pettis (5/7/2015)


    Catch the comment in this post: http://www.sqlservercentral.com/Forums/FindPost1683559.aspx

    The problem is that this newborn isn't really a newborn, but keeps asking questions and making comments that...

    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,951 through 4,965 (of 8,731 total)