Forum Replies Created

Viewing 15 posts - 3,376 through 3,390 (of 3,957 total)

  • RE: Select Number before "/"

    There's also a PATINDEX solution to this.

    DECLARE @t TABLE (mystring VARCHAR(100))

    INSERT INTO @t

    SELECT '100034/com.ccs.ccscontact'

    UNION ALL SELECT '1003/com.ccs.ccscontact'

    UNION ALL SELECT '100/com.ccs.ccscontact'

    UNION ALL SELECT '20005/com.ccs.ccscontact'

    SELECT SUBSTRING(mystring, 1, PATINDEX('%[^0-9]%', mystring)-1)

    FROM @t

    Just guessing but...

  • RE: Select a chain

    Or if you want your result chains laid out horizontally, you can do this:

    DECLARE @t TABLE (ID INT, FromID INT)

    INSERT INTO @t

    SELECT 1, 0

    UNION ALL SELECT 2, 1

    UNION ALL SELECT...

  • RE: Export SQL Server 2005 Table to Excel 2007 using T-SQL

    Strangely, I was working on something today that benefitted from this XLSX provider. I was SELECTing from OPENROWSET instead of INSERTing, but otherwise the requirement was the same.

    I had...

  • RE: Pipe delimited row in tsql

    vinu512 (6/19/2012)

    Hi Dwain,

    Can you post a link where there is a good explanation on the STUFF Function, the way it is being used here??

    I see it all the time, feel...

  • RE: Search with 80% accuracy

    I have no idea what I'm talking about here because I've never used it, but you might want to look at this link: http://msdn.microsoft.com/en-us/library/ms187384.aspx

    You can also try it with this...

  • RE: Calculate ABC category

    Eugene Elutin (6/18/2012)


    You should read the article (link at the bottom of my signature) about how to present questions like that to help your helpers to help you 😉

    create table...

  • RE: unique row id

    First of all, you needed to add the IDENTITY keyword to your customerID field, as it is a primary field and when you run your INSERTs it tries to INSERT...

  • RE: Pipe delimited row in tsql

    Jeff Moden (6/18/2012)


    krishusavalia (6/18/2012)


    Thanks , That's what I was looking for.

    Great. The next questions would be 1) Do you actually understand how it works so you can support it...

  • RE: Record Matching in FIFO Basic in Stock data

    Nice one Chris!

    I've been tearing out what little hair I have left over this one. I knew a recursive CTE was the way to go but both of my...

  • RE: need to replace

    Paul's trick was to change the collation on the field where REPLACE is to be run to a binary collation, specifically:

    COLLATE Latin1_General_BIN2

    You can read about it here:

    http://www.sqlservercentral.com/Forums/Topic1304299-391-2.aspx#bm1304646

    Either I'm not...

  • RE: need to replace

    Everybody's a critic! 🙂

    Seriously Cadavre, you make a good point. I just learned the PARSENAME technique and never really tried a performance test on it.

    However I do recall a...

  • RE: calculating quarter

    Then again, I suppose you could do something silly like this:

    SELECT n=16*t3.n+4*t1.n+t2.n

    FROM (SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) t1(n)

    INNER JOIN (SELECT 0...

  • RE: calculating quarter

    Jeff Moden (6/16/2012)

    --===== Create an populate the Tally Table

    SELECT TOP 11001

    N = IDENTITY(INT,0,1)

    INTO dbo.Tally

    FROM master.dbo.syscolumns sc1

    CROSS JOIN master.dbo.syscolumns sc2

    ;

    --===== Index it...

  • RE: Sum the most recent record for each day

    vinu512 (6/18/2012)


    dwain.c (6/18/2012)


    vinu512 (6/18/2012)


    You can do it like this as well:

    --Creating Temporary Table

    CREATE TABLE #Test

    (

    DateTimeStamp datetime,

    Value int

    )

    --Inserting Sample Data

    INSERT INTO #Test SELECT '2012-06-15 16:00:00.000',4

    INSERT INTO #Test SELECT '2012-06-15 2:05:00.000',5

    INSERT...

  • RE: need to replace

    vinu512 (6/18/2012)


    harri.reddy (6/17/2012)


    alright,consider this

    i have 1 variable

    declare @temp1 nvarchar(50)

    set @temp1 = 'P=70'

    now in 1 column i need p and in another i need 70 ,from @temp1

    so i need function who...

Viewing 15 posts - 3,376 through 3,390 (of 3,957 total)