Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)

  • RE: Set-based solution possible?

    If you don't mind having an intermediate help table (temporary or otherwise) you could use something like this - FillList may even prove usefull.

    /*

    Create Table ItemBin (

    Item varchar(80),

    BinId...

  • RE: Evaluating a string arithmatic expression

    nice one - efficient as well.

    quote:


    --Here is the function I was thinking of writing. It seems to work pretty well. It could...

  • RE: Evaluating a string arithmatic expression

    does this qualify as surreal?

    /*

    assuming that all the elements are separated by a space ' ' and

    the string is left justified (does NOT begin with a space)this should...

  • RE: How can I add Number at the end?

    CREATE TABLE #test (ID INT, letr varchar(1))

    INSERT INTO #test (ID, letr) VALUES(1, 'A' )

    INSERT INTO #test (ID, letr) VALUES(2, 'A' ) ...

  • RE: Most Recent Date

    This variation (using UNION) halves the number of table scans since you only need to scan each table once

    create table Site (id int,CreateDate datetime,DateChgd datetime)

    create table contact (id int,site_id int,...

  • RE: Count WeekDays

    --try this

    declare@WeekDays int,

    @StartOnDate datetime,

    @FinishOnDate datetime

    select@StartOnDate = '04/05/2003',

    @FinishOnDate = '04/28/2003'

    select @WeekDays = DATEDIFF(day, @StartOnDate, @FinishOnDate)+1

    - (1-abs(sign(1-datepart(weekday, @StartOnDate))))

    - (1-abs(sign(7-datepart(weekday, @FinishOnDate))))

    - DATEDIFF(week, @StartOnDate, @FinishOnDate)*2

    -- result

    select datename(weekday, @StartOnDate)StartOnDay, datename(weekday, @FinishOnDate)FinishOnDay, @WeekDays...

Viewing 6 posts - 1 through 6 (of 6 total)