Forum Replies Created

Viewing 15 posts - 1,261 through 1,275 (of 3,957 total)

  • RE: Looping Comma separated string

    hemang.patel (10/21/2013)


    Hi,

    Try these

    Declare @id bigint = 1

    Declare @string as varchar(100) ='100,200,300,400,500'

    DECLARE @testXML XML

    SET @testXML = N'<test>' + REPLACE(@string,',','</test><test>') + '</test>'

    SELECT @id [id],node.value('.','varchar(100)') as [No]

    FROM @testXML.nodes('/test') as records(node)

    How does...

  • RE: Query regarding AVG

    Almost there.

    So does cjohn count as 1 user on 04 Oct or as 2?

  • RE: Looping Comma separated string

    Like this?

    INSERT INTO SampleTable

    SELECT 1, Item

    FROM dbo.DelimitedSplit8K('100,200,300,400,500', ',')

  • RE: Retrieving Key/Value data from large table

    dogramone (10/21/2013)


    Have a look here, http://www.sqlservercentral.com/articles/SQLServerCentral/66909/, and then the experts will all come out to play and you will get a very nice solution to your problem.

    I agree so I'll...

  • RE: Query regarding AVG

    I think you need to be a little more clear about your expected output. To help out, here is you sample data in consumable form.

    WITH SampleData AS

    (

    ...

  • RE: how to compare variable to string?

    Firstly, to avoid confusion, % in the way you are using it is not the modulo operator, it is a search wildcard character.

    Secondly, I think what you may be trying...

  • RE: Best way to UPDATE with join to other tables...

    John Mitchell-245523 (10/21/2013)


    Beware, though - if you have multiple matches in joinTable for any rows in tableToUpdate then you'll get unexpected results. This is known as a cardinality error,...

  • RE: Obtaining unique data

    Illustrating what PietLinden suggested, which I like because it avoids the sort inherent in DISTINCT:

    WITH SampleData AS

    (

    SELECT invoice_no

    FROM

    (

    ...

  • RE: how to compare variable to string?

    Try changing your & to +

  • RE: palindrome

    Jeff Moden (10/21/2013)


    In that case, I strongly recommend that you drop the whole idea of using a WHILE loop ...

    Just in case the OP can't, I suppose there are lessons...

  • RE: Locking a record in Edit Mode

    GilaMonster (10/21/2013)


    dwain.c (10/21/2013)


    Not sure how advisable that is.

    It's strongly not recommended.

    I was being polite. Not meaning that you're being rude of course. But you've got better creds...

  • RE: Locking a record in Edit Mode

    PiMané (10/21/2013)


    There's a bad way to accomplish that..

    Just use XLOCK... XLOCK makes an exclusive lock to the record until the transaction is committed...

    On c# you can:

    1. begin transaction

    2. SELECT...

  • RE: Locking a record in Edit Mode

    I think you're going to have issues doing this no matter how you choose to "lock" the records, because if the user closes the web form while a record is...

  • RE: palindrome

    Jeff Moden (10/20/2013)


    The problem is, you used REVERSE which the OP said he couldn't do. Heh... you also forget that a Palindrome can contain numeric digits. 😀

    Nah... didn't forget....

  • RE: Writing Test Cases for T-SQL Code

    I made a rather small but silly mis-statement which I have corrected and resubmitted.

Viewing 15 posts - 1,261 through 1,275 (of 3,957 total)