Forum Replies Created

Viewing 15 posts - 166 through 180 (of 434 total)

  • RE: Adding workdays

    Jeff Moden (10/18/2007)


    mrpolecat (10/18/2007)


    This works as well though it can only go 1 year out. Not sure about the perfomance with the self join.

    declare @startdate datetime, @days int

    set @startdate...

  • RE: Adding workdays

    This works as well though it can only go 1 year out. Not sure about the perfomance with the self join.

    declare @startdate datetime, @days int

    set @startdate = '1/1/2007'

    set @days...

  • RE: Apparent Error with BETWEEN operator

    with char datatypes between (and > or < for that matter) do a character by character comparison not looking at the whole field as it would with numbers. If...

  • RE: how to remove numbers from strings?

    Doesn't that bring us back to Jeff Moden's function?

  • RE: how to remove numbers from strings?

    Tally is a table that you need to create with the column N. The fill it with the numbers 1 to whatever you think you need. This is...

  • RE: DTS problems after changing server

    if you msgbox(DTSDestination("ProcessingDateDate").Value) after you create it what do you get?

  • RE: bcp dump prompting for password - going nuts here

    I just ran into this yesterday, got fed up and used EM to import my file. Thanks for the info.

  • RE: table design

    you could put an insert trigger that sets it to "CAT" and an update trigger that disallows the update if it is set to "CAT" assuming that this is...

  • RE: SELECT current address

    You will need a derived table to join the 2 tables

    select s.*,a.*

    from students s

    join

    (select studentid,max(historyid) as maxhist from address) lastaddress

    on s.studentid = lastaddress.studentid

    join

    address a

    on a.studentid = lastaddress.studentid...

  • RE: Need help with stored procedure with cursor

    It should actually be

    WHILE @@FETCH_STATUS = 0

    From BOL

    @@FETCH_STATUS

    Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.

    Return value Description

    0...

  • RE: Need help with stored procedure with cursor

    Jeff Gray just posted this on another topic which might help you out as well.

    Another good trick for cursors:

    Declare cursor foo....

    Declare @someVariable INT

    open foo

    While (1=1)

    BEGIN

    Fetch foo into @someVariable

    IF @@Fetch_Status <>...

  • RE: Need help with stored procedure with cursor

    Also the select * for you cursor will come back to bite you when someone adds a column to your table and your fields don't line up.

  • RE: Need help with stored procedure with cursor

    I think what Jason meant was that you needed to add another fetch inside your while loop and close and deallocate outside the while loop. Try this

    declare cSource cursor...

  • RE: Generating Dates

    There is probably a better way to do it but this seems to work.

    SELECT di.Item, di.d_Date, #Values.Value

    FROM (select distinct d_date,item from #Dates ,#Values ) di LEFT OUTER JOIN...

  • RE: Generating Dates

    Please post the DDL of your tables, what you have written so far, and your desired results. That will make it easier to help you out.

Viewing 15 posts - 166 through 180 (of 434 total)