Forum Replies Created

Viewing 15 posts - 1,171 through 1,185 (of 5,502 total)

  • RE: I wanted my output something the below one.

    The FOR XML PATH solution is one way to do it:

    SELECT

    id,

    name,

    STUFF(

    (SELECT ',' + CAST(t2.marks AS VARCHAR(10))

    FROM #temp t2

    WHERE t2.id=t1.id

    FOR XML PATH('')

    ),1,1,'') marks

    FROM #temp...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Update Query problem for multiple tables

    You need to reference both tables:

    update table1

    set table1.Email = table2.Email

    FROM table1 INNER JOIN table2 ON table1.ID = table2.EmpID



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Pivot how to - help

    duplicate post. no replies, please.

    Already answered here.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Pivot - How to do this?

    Please have a look at the CrossTab article referenced in my signature. It will show you an easier way than the PIVOT operator...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: error when inserting date value

    The setting of DATEFORMAT might be different than the format sent by the app.

    Example: if the dateformat in the database is day/month/year and it's send in month/day/year, you'll get an...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Combining queries

    At a second glance it looks like you're using ACCESS (IIF is not really a SQL Server command...)

    With "presentation layer" I referred to Reporting Services, a .NET program or any...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Combining queries

    You could use the UNION ALL approach adding a blank column for the columns without values in each separate query.

    But I have to ask: Why do you need to use...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Converting a single row into Multiple rows

    Search this site for "DelimitedSplit8k" (Rev 06 is the current version AFAIK).

    The following query will return the expected result

    SELECT c.name, ID = LTRIM(split.Item)

    FROM MULT_VALS c

    CROSS APPLY dbo.DelimitedSplit8k(c.IDS,',') split



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: New Server MDF& LDF

    SQLRNNR (7/27/2011)


    Or in the worst case, restore a backup of the VM itself (maybe a prior snapshot). You may need to chat with your server administrators for that though.

    But...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Urgent: Handling [& , ' etc] in TSQL

    What might help is a list of 3 or 4 INSERT statements for the #CmdShell table that will show the file names you're trying to import.

    We could then create files...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Dynamic Pivot Columns for Changing column starting points

    I'm glad you like the two articles.

    But here's a disclaimer: I'm not the author. 😉

    Those articles are written by Jeff Moden, so the credit belongs to him. 😎



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Dynamic Pivot Columns for Changing column starting points

    Here's the "middle part" that actually needs to be dynamic:

    SELECT

    'MAX(CASE WHEN pos='

    + CAST(ROW_NUMBER() OVER(partition by periodid, routedirid ORDER BY sequence) AS VARCHAR(10))

    + ' THEN CONVERT(CHAR(5),tt.[time],114) ELSE...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Dynamic Pivot Columns for Changing column starting points

    Glad I could help 😀

    If you have any further questions regarding the dynamic solution, let me know. But give it a try first. If the code goes into production, you'll...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Dynamic Pivot Columns for Changing column starting points

    to get the ort order right, replace "order by ro.tripid;" with "order by MIN(tt.[time]) ;"

    Regarding the dynamic part: would it be an option to have the "real" column names in...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Problem with delete cascade and identity column in sql 2005

    The idea of an identity column per table is to uniquely identify a row in a table. The scope of this identity value is the table the column belongs to...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 15 posts - 1,171 through 1,185 (of 5,502 total)