Forum Replies Created

Viewing 8 posts - 1 through 9 (of 9 total)

  • RE: Complicated Subquery

    Run this ...

    declare @t1 table(a int, b datetime)

    insert into @t1 values(1, '9/1/2010')

    insert into @t1 values(2, '9/5/2010');

    declare @t2 table(a int, b datetime, c varchar(10))

    insert into @t2 values(1, '9/12/2010', 'Dublin')

    insert into @t2...

  • RE: Rows to columns

    Thanks in advance for any help you can provide.

    I have the following;

    ID Desc Amt Status

    1 Item1 10 Unknown

    1 Item2 20 Unknown

    1 Item3 15 Known

    2 Item1 25 Unknown

    2 Item2 10 Known

    2...

  • RE: Deadlocking in stored proc calls (sql 2008)

    Two developers invoke the same stored proc and a deadlock (usually) results. From the xml output of sql Profiler, the deadlock occurs on the PK of table B (B_ID). Here...

  • RE: Parameterize a query with a set of possible values

    You can use charindex too, but convert the string into table is better performance in general.

    EX: select * from @temp where charindex(id,@str) > 0

    Note, don't use this. It is a...

  • RE: distinct again

    Yeah, not sure why you have to start a new thread. Anyway ....

    select distinct * from table where column1 in (select distinct column from table)

    Not surprised if the query returns...

  • RE: Importing XML into a table

    Just add a root

    -------------------

    DECLARE @yourText varchar(10000)

    SET @yourText ='

    <Employee>

    <SSN>987654321</SSN>

    <Employee>

    <FirstName>MOREEN </FirstName>

    <MiddleName>B</MiddleName>

    <LastName>CORN </LastName>

    <Suffix/>

    ...

  • RE: Reading xml child node data

    Add address node as below

    //--------------------

    declare @x xml

    set @x = '<ROOT>

    <Createstudent>

    <id>30</id>

    <classId>1</classId>

    <lastname>ln</lastname>

    <midname>mn</midname>

    <firstname>fn</firstname>

    <degree>ms</degree>

    <address>

    <city>false</city>

    <state>false</state>

    <zipcode>false</zipcode>

    </address>

    </Createstudent>

    </ROOT>'

    select

    T.c.value('id[1]', 'int') as id,

    T.c.value('classId[1]', 'int') as classid,

    T.c.value('lastname[1]', 'varchar(50)') as lastname,

    T.c.value('midname[1]', 'varchar(50)') as midname,

    T.c.value('firstname[1]', 'varchar(50)') as firstname,

    T.c.value('degree[1]', 'varchar(50)') as degree,

    T.c.value('address[1]/city[1]', 'varchar(50)')...

  • RE: How to get the duplicate count

    I think you can do other ways better

Viewing 8 posts - 1 through 9 (of 9 total)