Forum Replies Created

Viewing 15 posts - 121 through 135 (of 327 total)

  • RE: datetime with seconds

    Don't need the "Left" in the DATENAME part.

    SELECT DATENAME(weekday, getdate()) as DAY,

    convert(char(20), getdate(),9)+ ' ' +

    Right(convert(varchar, getdate(),9),2) as [Date/Time]

    DAY                            Date/Time              

    ------------------------------ -----------------------

    Tuesday                        May 31 2005  3:56:23 PM

  • RE: datetime with seconds

    This seems to work:

    SELECT DATENAME(weekday, LEFT (getdate(), 12)) as DAY,

    convert(char(20), getdate(),9)+ ' ' + Right(convert(varchar, getdate(),9),2) as [Date/Time]

    DAY                            Date/Time              

    ------------------------------ -----------------------

    Tuesday                        May 31 2005  3:40:03 PM

  • RE: datetime with seconds

    Add this last part to get am/pm:

    SELECT DATENAME(weekday, LEFT (getdate(), 12)) AS Day, LEFT (getdate(), 12) AS

    Date, convert(varchar, getdate(),8) + Right(convert(varchar, getdate(),9),2) as [time]

    Edit: But I guess that...

  • RE: datetime with seconds

    This will get you the hh:mm:ss but not am/pm:

    SELECT DATENAME(weekday, LEFT (getdate(), 12)) AS Day, LEFT (getdate(), 12) AS

    Date, convert(varchar, getdate(),8) AS [time]

  • RE: Using something other than datetime for dates and times

    In cases where the time portion really did not matter I have used datetime with a constraint to ensure all of the time values were zero.  That way I retain...

  • RE: Using something other than datetime for dates and times

    I don't have any experience with custom types for dates but have in one instance been using datetime to store "just time" and its been working fine.

    I have to ask...

  • RE: Using ALL

    I found this in the Database Developer's Companion (books NOT online):

    If a subquery introduced with ALL and a comparison operator does not return any values, all rows in outer...

  • RE: converting to datetime data type

    This should give you a hint:

    select Right('00' + cast(month(getdate()) as varchar),2)

    ----

    05

  • RE: Firsrt day of a month

    For lots of good information on working with sql server dates you can check out these two articles:

    http://www.karaszi.com/SQLServer/info_datetime.asp

    http://www.sql-server-performance.com/fk_datetime.asp

  • RE: Nested Select Help

    The alias "a" referenced in the WHERE clause is not valid as there is no table with that alias.  "a' is only an alias within the definition of the derived...

  • RE: Copy from a table then delete

    Bob,

    By placing "@maxPunchID int" before the AS you created an input parameter to the stored procedure and as you discovered, were required to pass in a value for that...

  • RE: How to Determine Whole Dollar Amount

    Display of all amounts where cents = .00


    insert into #temp values (14.00)

    select * from #temp

    Where cast(amt as int) - amt = 0

    amt    

    -------

    14.00

    (1 row(s) affected)

    Edit:...

  • RE: How to Determine Whole Dollar Amount

    Are you trying to return all rows where the cents part is .00 or are your trying to convert the display of all amount so that they show .00?

  • RE: How to Determine Whole Dollar Amount

    I think this may be what your looking for:

    create table #temp (amt decimal(5,2))

    insert into #temp (amt) values (12.34)

    select cast(cast(amt as int)as decimal (5,2) )

    from #temp

           

    -------

    12.00

  • RE: I know I have seen this solution before.....

    Your welcome.   The other way would be to use a correlated sub query.

    Select ID, PathwayID

    From YourTable  as A

    Where ID = (Select min(ID)

                      From YourTable

                      Where PathwayId = A.PathwayId)

    Order...

Viewing 15 posts - 121 through 135 (of 327 total)