Forum Replies Created

Viewing 15 posts - 3,886 through 3,900 (of 4,087 total)

  • 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...

  • 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...

  • RE: system views sql

    You can also use the Information_Schema.Columns system view. It does all of the joins for you, and I find it much easier to remember one view.

    SELECT Table_Schema, Table_Name, Column_Name,...

  • RE: to check value exist in a node or not

    Instead of pulling back all nodes and then checking whether the local name matches, you should just pull back the nodes that do match.

    @x.exist('//ConsumerID') = 1

    From there, it's simple to...

  • RE: Basic xml formatting question

    You can specify attributes using [path/@attr]. For example,

    SELECT

    'center' AS ,

    td = [server] ,

    '' ,

    'center' AS ,

    td = [DatabaseName] ,

    '' ,

    'center' AS ,

    td = [Status] ,

    '' ,

    'center' AS ,

    td =...

  • RE: How to use store procedure to insert data in aspx page textboxes.

    SQL is unaware of the calling application, so it cannot manipulate the calling application. SQL just returns the data. It is up to the calling application to use...

  • RE: Adding a trigger for new Customer Order

    The main issue is that you are using

    INSERT INTO TABLE(Fields)

    VALUES(Values)

    when you should be using

    INSERT INTO TABLE(Fields)

    SELECT expressions

    FROM INSERTED

    I would also recommend using TRY...CATCH blocks.

    There are also undefined variables in your...

  • RE: Adding a trigger for new Customer Order

    If you have a specific problem, it would help if you specified what it was. If you just want to know how to get started, look up CREATE TRIGGER...

  • RE: Creating Table in Stored Proc With Phrase and Today's Date

    Also, the format that you're looking for in the CONVERT is 112, which gives you YYYYMMDD without the need to use REPLACE to get rid of extraneous characters.

    SELECT Convert(varchar(8), Getdate(),...

  • RE: Return set of dates from Date table for each group of records.

    Jim-720070 (9/2/2010)


    Why couldn't I use CTE's? You're kinda right.. I'm actually writing a Crystal report and this is the SQL I'm using in a command. Wish I could use CTE's...

  • RE: Incremental data

    Depending on the number of tables and the types of updates, replication may actually be your best option. SSIS is going to have a hard time dealing with deletes,...

  • RE: Using CASE WHEN to return a logical value in WHERE clause

    A conditional expression can't appear in your THEN clause. The generic way to fix this is to move it to the WHERE clause with an AND.

    WHERE CASE

    ...

  • RE: Try...Catch not catching

    Matt Miller (#4) (8/30/2010)


    Actually - compile errors (which I believe is what you'd get if you try to insert into a column that doesn't exist)

    Actually, that's a runtime error. ...

  • RE: Weird Sorting based on csv requirement

    Arjun Sivadasan (8/31/2010)


    So, as you can see, I need the entire list of records to generate the row number. If I take only a percent of the effective records, my...

  • RE: how can i do the delete statement without having to re-index?

    I think he's inserting into a temp table, then deleting from the temp table, and then inserting the remaining records into the production table.

    If that is the case, you might...

Viewing 15 posts - 3,886 through 3,900 (of 4,087 total)