Forum Replies Created

Viewing 15 posts - 16 through 30 (of 529 total)

  • RE: Getting row and column which trigger's fired

    The row that got updated can be found from the INSERTED or DELETED table. Those tables have the same layout as your source table, so if you take the PK-fields...

  • RE: how to Swap records

    A little bit more generic solution would be to build a (temporary) table that holds for each value to replace a pointer to the new record.

    
    
    CREATE...
  • RE: DB application off of a DVD

    Did you think about using any kind of 'Virtual PC' software? This gives you the possibility to run a complete machine from a DVD (only need the virtual PC software...

  • RE: Group By........

    If you got the correct results from 'my' query, you see that the solution you posted is correct. I just added your data and your query to a single script.

    Can...

  • RE: Checking Insert, Update, or Delete in Trigger

    Yep, in almost all case it is better to write separate triggers.

    I can only see the use of one trigger for all actions if you just want to record 'changes'...

  • RE: Foreign Keys as Primary keys on related tables

    You should clearly make the distinction between a primary key and foreign key. They are in no way related and serve completely different goals ...

    A primary key is a way...

  • RE: Group By........

    Try executing this, it should return the result as you expect it...

    
    
    USE Pubs
    GO
    create table testgroup
    (colA int,
    colB int,
    colC int)
    GO
    SET nocount on
    GO
    insert into testgroup values (1,40,0)
    insert into testgroup...
  • RE: Group By........

    This is very strange. The query you mention should return the result as you describe it, not the result you mention.

    Are you really sure about the source data and the...

  • RE: Foreign Keys as Primary keys on related tables

    Sounds to me like a logical solution for typical one-to-many relationships.

    From a technical point of view, you might consider placing a UNIQUE constraint on the child table (instead of the...

  • RE: Insert into select from taking hours (URGENT))

    Is it possible that your DB is autogrowing? Check the parameters of your DB. If it is set to autogrow, and your current size is near the maximum, try either...

  • RE: Retrieving updated rowset

    Don't think this is possible in SQL.

    Can be done in ADO (and the like). If you have an updateable RecordSet object, you can change the values of a row in...

  • RE: Top n with a twist

    Try the following code

    
    
    SELECT t1.product, t1.time_period
    FROM <table> t1
    WHERE t1.unique_row_id IN
    (SELECT TOP 10 t2.unique_row_id
    FROM <table> t2
    WHERE...
  • RE: Data for past one week

    Something like this...

    
    
    SELECT ...
    FROM ...
    WHERE DateDiff(Day, MyDateField, getdate()) <=7

    You might need some casting on the MyDateField. Post the exact format of the string if you can't...

  • RE: update across tables comparing millions of records

    I think you should look at removing all the OR statements. In general, an OR is bad for performance.

    Additionally, I would have a look at changing the IN statements in...

  • RE: Replace doing funny things

    The difference in Collation might explain the difference.

    The SQL_Latin1_... collation is a UNICODE collation. The Latin1_General_... is not.

    Under the hood, SQL Server is converting everything internally to a double byte...

Viewing 15 posts - 16 through 30 (of 529 total)