Forum Replies Created

Viewing 15 posts - 76 through 90 (of 244 total)

  • RE: Creating On Date change trigger???

    a calulated column would be better.

    alter tabe table

    add isactve case when dateexpires >= getdate then 0 else 1 end

     

    something like that

    This is more robust than the nightly sql agent...

  • RE: Searching Stored Procedures for Table Names

    Code below gets around 4000 syscomments split problem.

    declare @find varchar(1000)

    set @find = ''-- enter search string here

    set @sp_prefix = isnull(@sp_prefix,'') + '%'

    set @find = '%' + @find + '%'select distinct...

  • RE: How to divide one column into 5 columns.

    update table

    set col1 = substring(col,1,50),

    col1 = substring(col,51,100),

    col1 = substring(col,101,150),

    col1 = substring(col,151,200),

    col1 = substring(col,201,250)

     

    something like that

     

  • RE: Difficult Query

    You havent shown how these columns are related. If these tables have no relation then effectivly you arent storing which team assembled which component. Are there more columns or other...

  • RE: LEFT JOIN question

    obviously this applies equally to inner joins.

  • RE: rename a table

    create a SQL scheduled job written in VBScript then call the job using T-SQL.

  • RE: rename a table

    if its a sql table have a look at sp_rename if its an excel spreaqdsheet use xp_cmdshell with dos commands.

  • RE: Adding Steps to Scheduled Job

    investigate the sysjobs tables. one of these will contain a column which stores the 'quit with success\next step' status. Bung these values into a temp table before the delete then...

  • RE: Using WHERE IN(...)

    Ross

    this will not work SecurityGroupReferenceID is presumably an int and you are using strings in your in list.

  • RE: Using WHERE IN(...)

    Something like the below should work and be pretty efficient. Obviously i havnt tested this so use at your own risk.

     

    ALTER PROCEDURE dbo.treeViewDefaultDir

    @ListOwner varchar(200),

    @Roles varchar(2000)

    AS

    if  object_id('tempdb.dbo.#tmp') is not null

    drop table...

  • RE: ''''Sargable'''' where clause

    thats les efficient i replaced the or with the the isnull method just wondered if there was a better way.

  • RE: checking whether a stored procedure returns anything

    create proc usp_anyemployees

    declare @wellisthere int

    if exists (select 1 from employees)

    set @wellisthere =1

    else

    set @wellisthere =0

    select @wellisthere

    really you need to put an output param into your 1st sp and return that ...

  • RE: counting rows in a table

    yep you need to rebuild indexs and recompute stats if you want to use the no in sysindexes. Whats wrong with using count?

  • RE: checking whether a stored procedure returns anything

    does a 'little difficult' mean you dont understand it yourself? This doesnt sound like a real problem. Use @@rowcount on the first sp and pass to the second as input...

  • RE: Adding Steps to Scheduled Job

    click advanced and select quit with failure or more to next step depending on what you want it to do. If you don have expicit failures youneed to insert reults...

Viewing 15 posts - 76 through 90 (of 244 total)