Forum Replies Created

Viewing 15 posts - 586 through 600 (of 683 total)

  • RE: How to handle batch update in trigger

    Vikas,

    Try this:

    if update(StatusId2)

    update mytable

    set = ' Old StatusId2: ' + d.StatusId2

    from mytable mt

    join deleted d on d.PrimaryKeyField = mt.PrimaryKeyField -- change to correct column

    and d.StatusId2...

  • RE: Suming DateDiff

    Shane,

    Try this:

    declare @time1 datetime

    declare @time2 datetime

    set @time1 = '10:00:00'

    set @time2 = '11:00:00'

    select SUM(DATEDIFF(MI,stoptime, case when starttime <= @time2 then starttime else @time2 end)) AS 'Downtime'

    from

    where stoptime = @time1

    Hope...

  • RE: Join query (How to join to tables)

    select d.DepartmentName, e.EmpName, e.EmpAdd, e.DepartmentId, ...etc

    from Department d

    join Employee e on e.DepartmentId = d.DepartmentId

  • RE: Cursor for Log Truncation

    Hi Rama,

    Checkpoints occur automatically and they occur on a frequency that is based on the recovery interval.

    Look for "Checkpoints and the Active Portion of the Log" in BOL for a...

  • RE: Cursor for Log Truncation

    The problem is in the way that you are building the string for the dbcc shrinkfile.

    You're performing the select from sysfiles outside of the dynamic sql so it will always...

  • RE: removing unwanted text

    Hi,

    You can do this as follows:

    update my_table

    set user_name = replace(user_name,'ext-','')

    This will replace all occurrences of the string 'ext-' with the blank string ''. You have to be sure that...

  • RE: HOW TO GET THE NEW SERVERNAME WHICH WAS CHANGED AFTER SQL SERVER WAS INSTALLED

    run:

    sp_dropserver 'computer-2'

    go

    sp_addserver 'computer-1','local'

    go

    restart sql server services.

  • RE: Time Difference

    Hi,

    Try this:

    declare @yesterday datetime

    declare @today datetime

    set @yesterday = convert(datetime,convert(varchar(11),dateadd(dd,-1,getdate()),106) + ' 15:00:00.000')

    set @today = convert(datetime,convert(varchar(11),getdate(),106) + ' 08:00:00.000')

    SELECT PONum

    FROM PO

    WHERE

    POStatusDate > @yesterday AND POStatusDate < @today

    Hope that helps,

  • RE: Possible recursion within sproc - what''''s the best solution?

    Hi Julian,

    There is a good example in BOL on how to expand hierarchies and show all of the children for a given parent without using recursion. You want to...

  • RE: Plavement of rows when clustered index containing NULL values

    Sure,

    Just do a select * from

    .

    By default, the results are ordered on the clustered index (unless you explicitly use an order by clause).

  • RE: Plavement of rows when clustered index containing NULL values

    Hi Gabor,

    This depends on the order of the clustered index. If it is ascending, the null values will be at the beginning. If it is descending, the null...

  • RE: Renaming sql server 2000, how do I such thing?

    You first of all have to change the Windows server name. And then you have to change the SQL Server name in the same way you already pointed out,...

  • RE: Getdate Function

    The number 120 relates to the style you want to apply. In this case, it is yyyy-mm-dd hh:mi:ss(24h).

    Have a look in books online for CAST and CONVERT. It...

  • RE: Converting row into columns

    You want something like this. I haven't tested this out but you should get the general idea.

    create #a_temp_table

    (item_id int)

    declare @item_id int, @location int, @qty int, @new_location int

    set @new_location =...

  • RE: All parameters in SP

    Hi Eric,

    Unfortunately there isn't any table that tells you what variables have been declare inside the sp. You can find the variables that have been declare as part of...

Viewing 15 posts - 586 through 600 (of 683 total)