Forum Replies Created

Viewing 15 posts - 1 through 15 (of 26 total)

  • RE: How to use DB names dynamically?

    Normally if someone is looking to write this kind of dynamic code it can be rewritten so that the column names/database names are actually contained within the rows.

    e.g. I've seen...

  • RE: Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing

    After IF @@ERROR 0 in each case you have multiple statements - you need to surround these by BEGIN and END. As it works just now if there...

  • RE: Returning User Defined Data Requests.

    If the part that is dynamic includes the structure of the tables - e.g. column names, table names, then these can't be parameterised directly.

    You can however do the following:

    Insert everything...

  • RE: stored procedure checking for null recordset, and if it is, select using less specific criteria

    Rearrange order and check count(*)...

    IF @sProductManufacturer IS NULL

    BEGIN

    IF (SELECT count(*)

        FROM TblCartProducts

        WHERE (ProductCategory = @sProductCategory)

        AND (SubCat1 = @sSubCategory)

        AND (BestSell =...

  • RE: Help With a query

    If you add a clustered index to the table though....

    create clustered index idx_foo on #clients (clientid) 

    --cost = .0443

    select c1.ClientID

    From  #Clients c1

    JOIN #Clients c2 on c1.ClientID = c2.ClientID

    where c1.RegionID = 1...

  • RE: Trigger email on insert, update, delete

    Can you actually send an email using Outlook on the box?  Make sure you actually can send an email, if you can, then leave Outlook running and see if that...

  • RE: catching convert(,,) error in UDF

    I've not done this for a while but I believe if you stick what you want inside a stored procedure and handle the error from outside the stored procedure then...

  • RE: catching convert(,,) error in UDF

    ISDATE ( expression )

     

    Use the above before attempting to convert.

    Dave Hilditch.

  • RE: Trigger email on insert, update, delete

    You'll want to look at using the parameters available for xp_startmail to select the relevant profile you have created.

    BOL -

    xp_startmail [[@user =] 'mapi_profile_name']

        [,[@password =] 'mapi_profile_password']

    But I would warn...

  • RE: Question of the Day for 09 Aug 2004

    You can't get the previous or next row in from this table because there is nothing to tell you what to order by.  Can't assume that OrderID will always raise...

  • RE: Dynamic table name in a cursor?

    Have you thought about rotating the columns so they become rows?

    e.g 

    Have a table UserTables(userid, tablename, columnname, value)

    Then you wouldn't need to use dynamic SQL.

    Otherwise, from what I remember (I...

  • RE: How to combine these 2 Select Statements

    From what I can tell you want your first query to be the inner query of the second query.  If this is what you want, remove the ORDER BY clause...

  • RE: Help With a query

    Here's a couple of methods:

    create table clients (clientid int, regionid int)

    insert into clients

    select 222,1

    union

    select 222,28

    union

    select 444,1

    union

    select 444,44

    select clientid from

    clients

    where regionid = 28

    and clientid...

  • RE: Natural Sort Order

    create function leftNumberPart(@code varchar(10))
    returns int
    as
    begin
     declare @number varchar(10)
     declare @position tinyint
     set @position = 1
     set @number = ''
     while @position < len(@code)
     begin
      if isnumeric(substring(@code, @position, 1)) = 1
       set @number = @number + substring(@code, @position, 1)
      else
       break
      set...
  • RE: Updating a table with data from another table in other Database

    If you change SERVER=localhost does it remove the linked server error?

    If not, then add the linked server using the IP address above in Enterprise Manager (under Security).  The localhost thing...

Viewing 15 posts - 1 through 15 (of 26 total)