Forum Replies Created

Viewing 15 posts - 49,486 through 49,500 (of 49,552 total)

  • RE: Counting records inside a trigger

    Rule 1: You never need to use cursors

    Rule 2: If you need to use cursors, refer to rule 1

    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: Update Top 1

    I'm not sure I completely understood what you're trying to do, but the below code should be fairly close to what you're trying.

    If I've missed the mark by a...

    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: New Sql database question

    As a suggestion (I haven't read that article)

    Three tables (or more as your system requires)

    A person table (contans person's name, id, etc)

    A Person-BudgetNumber table (essentially a many-to-many link between Budget...

    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: Error Converting Datetime

    Don't know whether it has much, if any, affect on the server. I have found cases where it matters on the client.

    That said, I personallty prefer the format yyyy/mm/dd as...

    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: Error Converting Datetime

    Are you pulling data from a non-sql server source? I've before found, especially on mainframes, that dates are set to 0000-00-00 to indicate no data.

    Does very much sound like you've...

    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: problem in sql query

    It is possible, however bad database design leads to overly complex queries. and inaccurate results from queries

    It is a much better solution to have a properly normalised database structure and...

    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: Sort/Sum Records -- Please Help

    no guarentees, but it should give you some idea

    select count(customer), left(customer,CHARINDEX ('-', customer)-1) AS StoreName, city, st

    from table

    group by left(customer,CHARINDEX ('-', customer)-1), city, st

    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: Max count

    Select col1, max(col3) as MaxCol3 from tbl group by col1

    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: Is there a Better Way for this

    Because I forgot to initialise the string first and uninitialised strings are null. Add this before the select and it should work

    Select @finallist =''

    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: Is there a Better Way for this

    This should work.

    Create Function dbo.RO_TEST (@COMP VARCHAR(50))

    Returns Varchar(1000)

    As

    Begin

    Declare @finallist As varchar(1000)

    SELECT @finallist = @finallist + C.[CLIENT] + ', '

    FROM [_SMDBA_].[_CUSTOMER_] C, [_SMDBA_].[_COMPANY_] CO

    Where...

    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 08 Oct 2004

    There is nothing stopping you changing the values of the primary keys at either the publisher or subscriber.

    You can't change the structure or definition of the primary key at...

    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 08 Oct 2004

    This comment should have been posted under QotD for 1 Nov, not 8 Oct.

    That said, a transactional replication replicates changes made at the publisher to all the subscribers, not...

    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 19 Oct 2004

    It's not a syntax error. The code is valid and executes.

    It may well be a logic error, but syntaticaly it's fine.

    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 06 Oct 2004

    According to BoL, the method is called ListAvailableSQLServers, not ListAvailableServers. Hence, no such method exists.

    Or is BoL wrong?

    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: Convert getdate() to date only

    I've always used CAST(FLOOR(CAST(getdate() AS FLOAT))AS DATETIME)

    Watch out if you use round. Floor truncates the floating points so 2004/10/06 16h00 becomes 2004/10/06 00h00.

    If however you use round, 2004/10/06 16h00 becomes...

    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,486 through 49,500 (of 49,552 total)