Forum Replies Created

Viewing 15 posts - 3,736 through 3,750 (of 13,462 total)

  • RE: query help

    assuming the data types of col1 and col2 are varchars:

    update SomeTable

    SET Col3 = Col1 + Col2

    if they are integers, you will have to explicitly cast/convert the two columns.

  • RE: Help me tune this query...Please. :)

    the actual execution plan, if oyu can post it as a .SQLPlan file, would give us the most detailed information;

    aside from that, here's what i see:

    i see six objects in...

  • RE: How to switch ID number to new values (but maintaining duplicates for new ones)

    would doing something like selecting a newid() help?

    for example, have them do something like this:

    SELECT

    NEWID() AS RefID,

    OtherColumnsButNotTheRealID

    Into TableForExport

    From tblPatients

    --OR

    SELECT

    identity(int,1,) AS RefID,

    OtherColumnsButNotTheRealID

    Into TableForExport

    From tblPatients

    then...

  • RE: elegant strategies for complex update statements?

    sql has the ability to update a table based on another table, you just need to get used to the syntax.

    the advantage is it would be set based,and allow you...

  • RE: TSQL to get users and permissions

    glad i could help a little Sapan;

    note that sp_msForEachDb is really is a cursor behind the scenes;

    while cursors are generally frowned upon, when fiddling with metadata, this is one...

  • RE: How to preserve global temporary table data

    rajarshi_ghosh_05 (4/4/2013)


    {snip}

    No. We dont bother about the temp table data not if anything happens like network failure or server restart or user system restart! We dont have to preserve that...

  • RE: Restore table in sql server

    you restore the last good backup as a new database name.

    then you can use cross database queries move differences from one table to another;

    depending on the foreign keys, you might...

  • RE: TSQL to get users and permissions

    RexHelios (4/4/2013)


    Lowell (4/4/2013)


    ....see how i modified it to sue sp_msForEachDb,....

    Didn't realize we could sue other members' stored procedures 😉 Just an attempt to pump some humor, Lowell. No offense meant....

  • RE: TSQL to get users and permissions

    something like this seems to work for me, see how i modified it to sue sp_msForEachDb, and to INSERT INTO a #temp table, and read the results at

    the end.

    CREATE...

  • RE: How to get all 7 days Name in One table.

    you have to select form a CalendarTable, which would contain all possible dates, and left join it to your data that has the rest of the data.

    you can generate a...

  • RE: Date functions..

    i though blank() was a new SQL 2012 function, haha; pasted it to test and everything!

  • RE: Grouping field in alphabetical order not in order needed

    without the real code, i could just post a snippet:

    but it something like this:

    SELECT ColumnList,Priority

    From YourTable

    GROUP BY ColumnList,Priority

    ORDER BY

    CASE Priority --the column we will custom...

  • RE: Char(9) to Time

    not sure what you can do yet;

    two of the values cannot be directly converted to TIME datatype (the zero and negative values)

    msdn says the possible values for TIME datatypes are...

  • RE: Grouping field in alphabetical order not in order needed

    Sure :

    ...

    ORDER BY

    CASE

    WHEN 'Top Priority'

    THEN 1

    WHEN 'High'

    THEN ...

  • RE: Prevent DDL Triggers from disabling

    holy crap! you have people with sysadmin permissions, on the Live server, Klutzing around and making DDL changes at will?

    time to update your resume, it's only a matter of time...

Viewing 15 posts - 3,736 through 3,750 (of 13,462 total)