Forum Replies Created

Viewing 15 posts - 61 through 75 (of 173 total)

  • RE: Ripping a date apart

    Quick note on my above script, the string does not have to be converted to datetime, it's implicity performed (run the script).



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Creating a batch file to run multiple SELECT statements and output to a csv file.

    Hello.

    If you still need a more detailed example then you may want to use the Build Query button in the Transform Data Task.  This option will give you a GUI...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Ripping a date apart

    try this

    DECLARE  @Month varchar(50),

      @Day varchar(50),

      @Year varchar(50),

      @Date datetime

    Set @Month = '9'

    Set @Day = '13'

    Set @Year = '2004'

    Set @Date = @Month + '/' + @Day + '/' + @Year

    print @date



    Everett Wilson
    ewilson10@yahoo.com

  • RE: subquery returning entire row based on comparison and min value

    Ouch.  The problem being that you really don't want to stick the 10 joined tables into the subquery in order to find one lousy data point.  I don't know any...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Problem with dynamic order by

    Hmm, didn't even think of checking the Year and Month order by part of your statement but yeah, string sorting is performed one character at a time with blank (or...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Date and Not Time

    The problem is there's no easy way to compare only dates in a datetime field.  I know of a couple of ways to do it that require one extra step.

     ...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Transactional Replication Synchronization Issues

    I don't know what the problem is but my next step would be to run a trace.

    Good luck.



    Everett Wilson
    ewilson10@yahoo.com

  • RE: subquery returning entire row based on comparison and min value

    I didn't test this, but..

    SELECT ActualTable.*

    FROM ActualTable

      INNER JOIN

          (SELECT Min(Priority) AS Priority

          FROM ActualTable

          WHERE Value > 15) MinPriority

        ON ActualTable.Priority = MinPriority.Priority

    Note that this will return all records...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Is the getDate function the correct function to use?

    Hello

    The CONVERT function allows one to choose the date format the actual comparison takes place in. 

    101 is the mm/dd/yyyy format

    103 is dd/mm/yyyy

    Look up CONVERT on BOL for the full...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Date and Not Time

    My understanding is that datetime will hang on to the time element, meaning you either need to set all datetimes to one time (midnight) or perform the comparison in a...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Problem with dynamic order by

    I believe the ASCII function produces values based on the first character (at least it did on my test server).  Try this:

    use Northwind

    declare @SortBy char(10)

    select @sortBy = 'Name'  

     

    SELECT...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Is the getDate function the correct function to use?

    sorry for not having a cleaner example but it boils down to using the DATEADD funciton.

     

      CASE WHEN AwardDate = CONVERT(varchar(12), DATEADD(day, -6, GETDATE()), 101) THEN 1

       ELSE 0 END AS AcceptInd,



    Everett Wilson
    ewilson10@yahoo.com

  • RE: SQL query -- searching for part of a datetime value.

    Would converting to a string answer your problem?  For example, the select statement below finds all of the sales made on one date.  The print statement are an example of...



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Cursors or Direct T-SQL

    No doubt your way is faster.  Not to metion it's a good habit to accomplish tasks without using cursors since it helps train to mind to see cursor free solutions.

     



    Everett Wilson
    ewilson10@yahoo.com

  • RE: Varchar too small, Text too difficult; Now What?

    I think Bruce's idea of a table is still worth keeping in the back of your mind.  If I'm ever really, REALLY bored and need a challenge I plan on moving...



    Everett Wilson
    ewilson10@yahoo.com

Viewing 15 posts - 61 through 75 (of 173 total)