Forum Replies Created

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

  • RE: displaying the rows

    A EVA data model creates huge problems for those who are unwise enough to fall into the trap: No data integrity on data types, no referential integrity, no way to...

  • RE: weekday function

    Yes, but 1900-01-01 is not good for the code I posted, because dates earlier than 1900-01-01 would return a negative modulus.

    Since there is no SQL Server datetime before 1753-01-01, there is...

  • RE: Moving a 40GB db

    If you use PKZIP 5 or later, which has been out for 3 or 4 years, there is no limit on the size of the compressed files, and I have...

  • RE: Moving a 40GB db

    If you do it correctly, you should be able to move the database with only a few minutes of downtime.

    1. Backup the database and copy the backup to the new...

  • RE: Getting the Time part out of a DateTime

    This will give the time as an offset from midnight on 1900-1-1, the SQL Server zero day.

    -- Subtract Date from Datetime to get Time on 1900-01-01
    select	MyTime = MyDate-dateadd(dd,datediff(dd,0,MyDate),0)
    from
    	( Select MyDate...
  • RE: weekday function

    I guess I just know because it is the very first date that SQL Server supports, and I only had to look it up one time.

    In any case, DATENAME(dw,'17530101') would be...

  • RE: Workday calculations

    Try this function:

    drop function fn_Last_Workday
    go
    create function fn_Last_Workday
    	(@start_day datetime,
    	@work_days int)
    returns datetime
    as
    begin
    declare @end_day datetime
    declare @prior_workday datetime
    declare @weeks  int
    declare @remaining_days int
    -- Return null if input parameters are invalid
    if @start_day is null or @work_days is null or @work_days < 1
    	begin...
  • RE: Convert to For/Next

    The function you posted is a scalar function, which means it can only return a single value.

    If you want it to return more than one value, it will have to...

  • RE: weekday function

    That is the point of the code I posted.  Since it doesn't use the DATEPART function, the setting of DATEFIRST has no effect on it.

    It finds the day of the week...

  • RE: Data At Home

    I have a PC XT with a 20 MB hard drive and twin 5.25 floppy drives.

     

  • RE: Workday calculations

    I don't understand what the problem you are trying to solve is.

    Please explain and give examples.

     

     

     

     

  • RE: weekday function

    The value that datepart(DW,MyDate) returns depends on the setting of datefirst.

    This code will always return a value of 0 for Monday, 1 for Tuesday,...,  6 for Sunday, no matter what...

  • RE: Convert to For/Next

    CREATE function GetRespondentFinal(
      @RespondentID  int,
      @SurveyInstanceID int)
    returns int
    as
    begin
    declare @xfinal int;
    set @xfinal=null;

    select  @xfinal=max(mfinal) from (  select  MAX(sie.Final) mfinal  from EventLog el, surveyInstanceEvents sie  where el.respondentid = @respondentid    and el.eventID = sie.eventID    and sie.SurveyInstanceID =...

  • RE: Shortest Path Algorithm

    What is it that you want help with.  Creating a table?  Calculating the distance?  Something else?

  • RE: Extended Stored Procedure to access the command shell

    This doesn't really seem to be a T-SQL question.

     

     

     

     

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