Forum Replies Created

Viewing 15 posts - 13,801 through 13,815 (of 13,847 total)

  • RE: Break down update statement

    Your UPDATE statement needs to contain a WHERE clause which specifically excludes all records which have already been updated - and this will, of course, depend on your update logic.

    Note...

  • RE: How to find Rank(return Top 3 Country)

    Try something like this:

    select top 3 record, date, country, sales

    from (tablename)

    order by sales desc

  • RE: Trapping errors on linked servers

    I suspect that your problem occurs before the Select statement has a chance to run on the linked server, so your @error checking never executes.

    Your method of error trapping will...

  • RE: Convert Varchar into numeric

    You might like to qualify 'decimal' with 'precision' and 'scale' arguments - eg decimal(9,5) gives you 9 decimal positions per number to play with - up to five of them...

  • RE: How do I list Permissions for DB roles in Query Analyser.

    Here's a routine that executes the same command for all databases in an instance.  You should be able to modify it to plug in your commands.

    declare @sql varchar(400)

    set @sql='select...

  • RE: Error 512: Subquery returned more than 1 value....

    I too have seen this error, with queries like

    select * from table1 t1 where t1.id = (select t2.id from table2 t2 ... where t2.id = t1.id)

    The error occurs when...

  • RE: Divide By Zero Error in WHERE Clause

    Sorry to nit-pick, but just got up at 4am to watch England exit Euro 2004 on penalties, so I'm on the war-path!

    Quoting from the original post, the required result in...

  • RE: SQL server 2000 : strange bugs...

    Could it be a locking issue (eg table locked for update so other users can't access it)?  Might be worth running Profiler to check.

  • RE: Output results based on row comparison?

    I'm with warey on this.  Please explain how the data are linked and give an example of the output you are trying to get to.

  • RE: SQL server 2000 : strange bugs...

    Can you post the exact error message that you are getting and the circumstances under which it is displayed?

  • RE: Divide By Zero Error in WHERE Clause

    Kenneth, if field1 is anything other than zero, your solution won't produce the required result: instead it will produce (field1 + (other calculations)), in the case where field2 is zero.

    However,...

  • RE: Divide By Zero Error in WHERE Clause

    I think the Case statement is the way to go.  Something like this:

    SELECT Field1, Field2, etc...

    FROM tbl_Purchase

    WHERE ((case field2

    when 0 then 0

    else field1/field2

    end)

    + (other calculations)) > 0

    Regards.

  • RE: TRigger Problem

    So, on insert to table2, need to set t2.refno to

    select refno from table1 t1

    where t1.email1 = t2.email2?

    (where t2 is aliased to table2)

    Is table1.email1 unique?  If not, obviously an issue here...

  • RE: TRigger Problem

    This is a bit confusing and needs a bit more info.  Are you saying that every time you create a record in table1, you need to create an associated record...

  • RE: Append query - best architecture

    Nice thinking and thanks for the response - you've approached it from an angle I hadn't considered. 

    But had to get on with it and have already written a wedge...

Viewing 15 posts - 13,801 through 13,815 (of 13,847 total)