Forum Replies Created

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

  • RE: Error creating index on view

    I found this in books online.  Maybe the DISTINCT is causing the error.

     

    Restrictions on indexed views

    The SELECT statement defining an indexed view must not have the TOP, DISTINCT, COMPUTE, HAVING,...

  • RE: Converting field from upper case to mixed case

    Here's a UDF that I found sometime back.  It assumes the First letter of the string and every letter after a space should be capitalized.  All else is set to...

  • RE: Join Column

    Table A : 

    ID RegDate

    1 2005/1/15

    2 2005/1/16

    3 2005/1/18

    4 2005/1/20

              

    Table B : 

              

    ID RegDate

    1 2005/1/15

    2 2005/1/17

    3 2005/1/18

    4 2005/1/19

    5 2005/1/20

    6 2005/1/22

    If the ID values for both tables can...

  • RE: Join Column

    Is there a primary/foreign key relationship between the two tables?

    There would need to be a way to join the two tables together and match rows.

     

  • RE: What does ''''%[^0-9]%'''' mean?

    Greg,

    Sending a short reply as you did is a great way to show appreciation.

    Glad I could help.

    Mark

     

  • RE: Getting the ID of an INSERTed record

    You probably want to look into SCOPE_IDENTITY in books online.

    Here's a short description

    SCOPE_IDENTITY and @@IDENTITY will return last identity values generated in any table in the current session. However, SCOPE_IDENTITY...

  • RE: What does ''''%[^0-9]%'''' mean?

    If you search for LIKE in books online you'll see a description of each piece of this.

    In a nutshell it is saying if any characters in the string are not...

  • RE: sql server Raiserror function

    My guess would be that there would only be extra overhead when the RaiseError was invoked (Maybe not even then).

    You could test it by running a script without any RaiseError...

  • RE: Cursor won''''t fetch next row?

    The scenario I've seen it used is when you don't want it to enter the loop if the initial fetch doesn't return anything (I failed to include an IF check...

  • RE: Cursor won''''t fetch next row?

    Both Prasad and Vidas are referring to a more common syntax where you do one fetch outside the loop, then another inside like.

     

    FETCH NEXT INTO

    WHILE @@FETCH_STATUS = 0

    BEGIN

    ...

    ...

    FETCH NEXT INTO

    END

     

    Your syntax...

  • RE: How to inherit properties of database column in procedure/Function?

    As far as I know there is no direct equivalent to this in SQL Server.  You can use sp_help <tablename> to generate a list of column names and their types...

  • RE: Cursor won''''t fetch next row?

    Try declaring your cursor as static like

    'declare muCursor cursor static for ...

    It is likely the cursor is resetting when the table data changes from your update.

    I should also add that...

  • RE: Help in joining three tables for COUNT

    Either of these methods should work.  Somebody may post an even better way too.

    select a.clientid

         , m.messagecount

         , o.ordercount

      from clients as a

      join (select a.clientid,

                   count(b.clientid) as messagecount...

  • RE: ANSI_NULLS

    Since the parameters and the table values could both be NULL, you need to convert each into something you can compare with.  So the following syntax works.

     

     select x,y

     from  Table1

     where isnull(x,'') =...

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