Forum Replies Created

Viewing 15 posts - 3,871 through 3,885 (of 4,085 total)

  • RE: Alternatives for nested cursors

    Craig Farrell (9/15/2010)


    - For these users, they need all items from somewhere else...

    -- Cross Join to create master list of user/itemcodes

    It's actually not a CROSS JOIN, because the value of...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Alternatives for nested cursors

    You really should provide TEST DATA. Despite that, I think that this is what you want.

    INSERT INTO dbo.Privs(Username, GroupCode, ItemCode, LevelVal)

    SELECT DISTINCT p.Username, p.GroupCode, g.ItemCode, g.LevelVal

    FROM dbo.Privs AS p

    INNER...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trigger

    Tara-1044200 (9/15/2010)


    I am still getting the erorr , may be i cant use this in a single query batch

    USE DB1;ALTER TRIGGER.......

    USE DB2;ALTER TRIGGER.......

    USE DB3;ALTER TRIGGER.......

    USE DB4;ALTER TRIGGER.......

    'ALTER TRIGGER' must be...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Can Windows variables Be Used Within T-SQL

    Either Host_Name() or @@SERVERNAME should give you what you need. Host_Name will give you the name of the workstation that initiated the process, @@SERVERNAME will give you the name...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Please help=it's urgent,Cluster failoverd to node b.

    You might get better help faster if you had posted this in the correct forum. While you might find an expert on clustering in a T-SQL forum, you're much...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Importing a .txt file into SQL Server 2005

    Are you really using DTS instead of SSIS?

    It would really help to have SAMPLE DATA. Without that, it's really hard to determine the best course of action.

    It sounds like...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trigger

    You must not have included the "GO" statement in your dynamic SQL.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trigger

    It's actually fairly easy, because your trigger code doesn't change between databases. Since this is probably only a one-time thing, I would just copy the results of the dynamic...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trigger

    Tara-1044200 (9/10/2010)


    Hmm thats a pain if i have to add trigger to every database there are more than 400 db's. any trick?

    Dynamic SQL. That's how I created triggers on...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trigger

    I check BOL and it looks like DROP_TABLE is not valid for server level events. You can only use the following at the server level: ALTER_AUTHORIZATION_SERVER, CREATE_DATABASE, ALTER_DATABASE,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Create, Rename, Delete file folder thru SQL

    BOL is SQL Server Books OnLine. If you Google "BOL SQL" and click "I'm feeling lucky" it will take you right there.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: ORDER BY with CASE statement

    Magy (9/10/2010)


    Yes, I would like to be able to do this:

    ORDER BY

    CASE

    WHEN @SortSeq = 'asc' AND @SortOrder...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Outer Join or SubQuery

    You just need to apply your filter criteria before or as part of the join statement. You can use a CTE to filter the records before the join or...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trigger

    You'll need to create a DDL Trigger.

    CREATE TRIGGER YourTrigger

    ON ALL SERVER

    AFTER DROP_TABLE

    AS

    <Your code here.>

    You'll need to use the EVENTDATA function to get the command issued to see if the table...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: ORDER BY with CASE statement

    It actually sounds like the OP wants both a primary and secondary sort for each sort order choice. If that is the case, there are two options:

    1) Have...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,871 through 3,885 (of 4,085 total)