Forum Replies Created

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

  • RE: Whats wrong with DISTINCT in this query?

    eh? :ermm:

  • RE: Whats wrong with DISTINCT in this query?

    lol...........ok, do you have any idea why it is complaining then mate?

    Its distinct [ReviewID]'s im looking for. I should also point out that [feManagedReview] is a view.

  • RE: Whats wrong with DISTINCT in this query?

    Hi, thanks for the reply. Not sure what you mean though........im not using a group by at all.

  • RE: Selecting top 'x' number of rows through a sp

    Its fine, Got it:

    SELECT TOP (@TOP)

    cheers

  • RE: Where am i going wrong?

    bump

  • RE: Where am i going wrong?

    Hi mate.

    Yes ive broken it down and ran the indivdual elements and they all run correctly. This one really has got me stumped!

  • RE: Where am i going wrong?

    Hmmm im now wondering if it is something to do with putting an ALTER command within a BEGIN......END.

    Im getting similar weird errors when trying to alter views and stored procs!

  • RE: Where am i going wrong?

    Jason Shadonix (6/5/2008)


    Are you sure there aren't any stray characters in your query window? Might try copying the code to a fresh window to rule that out.

    Hi.

    Yeah 100% sure...

  • RE: Where am i going wrong?

    Hey dude.

    OK ive removed the line and my code is such:

    ?IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_tblProductStockNote_tblLookup]') AND parent_object_id = OBJECT_ID(N'[dbo].[tblProductStock]'))

    BEGIN

    PRINT N'Adding foreign keys to [dbo].[tblProductStock]'

    ALTER...

  • RE: Where am i going wrong?

    Hi im not sure why the ? appeared there. In the error message it just ''.

    Anyway, i ran the following:

    SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_tblProductStockNote_tblLookup]') AND parent_object_id =...

  • RE: Check if a primary keys exists

    Brilliant.

    Thanks again Noel..........much appreciated.

  • RE: Check if a primary keys exists

    Noooooo the saga continues!

    OK........ive made the changes and have ended up with the following:

    IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'PRIMARY KEY'

    AND...

  • RE: Check if a primary keys exists

    Aaaaaaarrrrrgghh!!! :blush:

    Thank you very much noel. Much appreciated!

  • RE: Check if a primary keys exists

    Hello noel..........again many thanks. However it would appear the error is definately in the first few lines. I stripped it back to the following:

    IF NOT EXITS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS...

  • RE: Check if a primary keys exists

    Hi. Once again thanks for your swift response 🙂

    OK..........i removed the 'GO's and the code i am left with is:

    IF NOT EXITS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE =...

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