Forum Replies Created

Viewing 15 posts - 331 through 345 (of 345 total)

  • RE: create and insert a table which name is passed to

    College had an interesting one recently

    update #tbl

    set fld = 'asd'

    from #tbl left outer join #tbl2 on #tbl.fld1 = #tbl.fld2 and #tbl2.fld3 = 'zxcv'

    where #tbl.fld4 = ''

    It should have updated every...

  • RE: Views vrs Derived Tables

    I've come across problems with deeply nested views where the server can take a long time to generate the plan (hours) and getting differring plans depending on which order things...

  • RE: create and insert a table which name is passed to

    The v7 problems are probably the locking issues where if a temp table was created in one sp and used in a called one then it was fine in a...

  • RE: OLAP

    Agree about DTS (twice in one day - I must be mellowing).

    People seem to see transfer and automatically jump into it and get into trouble.

    I think of a transfer as...

  • RE: create and insert a table which name is passed to

    Agree with Andy Warren - you might want to do it with a global temp table though for a bcp / xp_sendmail

    anyway - something like this should work.

    Whenever you're building...

  • RE: Next 'row' in select

    I suspect you want something like this - probably are easier ways and ma=ybe you could use the ID if the datetimes are consecutive.

    select log.ID, Log.[datetime] ,

    case when coalesce(l2.[datetime],'1 jan...

  • RE: Dropping like tables

    >> I mean no disrepect.

    Chances of me ever taking it are very slim - hope you're as thick skinned (/confident).

    >> especially if they are coming from a row processing background.

    That's...

  • RE: Strategy to schedule printing runs of Sqlserver7

    What are you going to do with the output.

    You will need a record of what is produced. If this is to be in the database then you should probably populate...

  • RE: Death of the Production DBA

    Sure there's room for production DBAs but I consider them to be allied to the infrastructure depatment rather than development or application support (other than at a superficial level).

    I consider...

  • RE: Looping through a select statement

    to save the last substring you could make this

    declare @r nvarchar(1000)

    select @r = coalesce(@r+',','') + rtrim(type) from SM_Servers,SM_group_Link where (SM_group_Link.group_name = @pop_group) and (SM_servers.ID = SM_Group_Link.group_item)

    ...

  • RE: Dropping like tables

    You will end up doing single row processing but as soon as you use the explicit cursor you are limitting yourself to processing a single row from then on. Usually...

  • RE: Using sp_MSforeachdb

    You can always simulate a use database command by putting the command in a string and executing via sp_executesql

    i.e.

    use dbname

    exec sp...

    should be the same as

    exec dbname..sp_executesql 'exec sp...'

  • RE: Using sp_MSforeachdb

    you could try it with an exec (look at sp_MSforeachtable to see what it generates).

    But why use sp_MSforeachtable anyway, you will probably find it safer and easier to code yourself....

  • RE: Dropping like tables

    You should never need to use a cursor and it is usually the worst way.

    In this case you can just

    select 'drop table ' + name from sysobjects where type =...

  • RE: Error Handling inside a transaction

    You could have

    Create PROCEDURE u_errorTest AS

    DECLARE @intError int

    SELECT * FROM CUSTOMERSzzzzzzzzzzzzz

    SET @intError = @@ERROR

    IF @intError <>0 GOTO Errh

    BEGIN TRANSACTION

    SELECT * FROM CUSTOMERSzzzzzzzzzzzzz

    SET @intError = @@ERROR

    IF @intError <>0 GOTO TxErrh

    COMMIT TRANSACTION

    Return

    TxErrh:

    ROLLBACK...

Viewing 15 posts - 331 through 345 (of 345 total)