Forum Replies Created

Viewing 15 posts - 49,396 through 49,410 (of 49,552 total)

  • RE: getting violation of PK (duplicate records) error

    Depends what you want to do with the records.

    If you have 2 records with the same ID, createdate, modified date and different cardtypes, then which one do you take?

    What about same...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Trigger Help

    You wouldn't be a developer rather than a DBA would you

    Be nice. I'm a developer.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: getting violation of PK (duplicate records) error

    You've got two completely identical records in ETable1. While your subquery is correctly retrieving no duplicates, as soom as joi do the join back to Etable1, there's a dup sneaking...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Trigger Help

    I hate cursors. There's usually a better way....

    The way you've written it, if there are multiple rows inserted at once, only one of...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Trigger Help

    The only way is to match what's in inserted with the real table is on a unique field or a unique combination of fields. SQL has no concept of row...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Trigger Help

    What's the primary key of the table?

    As an aside, the way your trigger is written only caters for single row inserts. Try this

    IF EXISTS (SELECT 1 FROM ProductionControl WHERE IRN IN (SELECT...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: SELECT INTO statement

    Note that #myTemp and ##myTemp are two different tables.

    I can't see anything obviously wrong.

    I recomend you replace the exec(@sql) with print @sql to see exactly what the server's going...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Question of the Day for 13 Sep 2005

    It's hardly undocumented. If you look through the articles on 64-bit SQL (on the MS site) it's quite clear that most of the tools don't have a 64-bit version. The...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Delete is so slow, help

    Yup. I've got a massive cascade structure in my db. A parent table cascades to 8 child tables, each of which cascades to two more.

    I had no joy with indexes,...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Using EXECUTE with a Character String

    In this case, since you don't need to return a value, you can concat the string together and exec it.

    SET @sql = 'Update ' + @tbl + ' Set .........

    EXEC...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Using EXECUTE with a Character String

    Glad to be of some assistance. I'm from South Africa

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Using EXECUTE with a Character String

    Your SQL string should read

    SET @sql='SELECT @lvido=lvid FROM ' + @tbl + ' WHERE lvid=''' + @lvid + ''''

    You want the variable to be part of the string that...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Using EXECUTE with a Character String

    You seem to be missing the line where you declare the SQL string.

    Yup, that'll work too, just a matter of where the variables...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Using EXECUTE with a Character String

    You never give @lvido a value, which means it is null. concat a null into a string and you get a null.

    Regardless, I think...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: How to authenticate users in the sysuser table?

    the sql passwords are stored (in encrypted form) in syslogins, which is found in the master database.

    Why do you want to use the SQL users table for authentication, not your...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 49,396 through 49,410 (of 49,552 total)