Forum Replies Created

Viewing 15 posts - 406 through 420 (of 1,923 total)

  • RE: Query help

    If there are 20 days that they did not logout, you need all of those 20 days? and u need it for all employees?

    Or u need those days that the...

  • RE: Query help

    This?

    DECLARE @TableA TABLE

    (

    EmployeeIDINT

    ,EmployeeLoginDateTimeDATETIME

    ,JobFunction VARCHAR(25)

    )

    INSERT @TableA

    SELECT 123,'2012-02-01 01:00:24','Coding'

    UNION ALL...

  • RE: need help w/ my sort coulmn

    Take 2! 😀

    ; with cte as

    (

    SELECT

    [sort]

    ,[InventoryItemId]

    ,[WebOptionName]

    ,[WebCategoryId]

    ,[WebSubCategoryId]

    ,AnchorRN = ( ROW_NUMBER() OVER ( PARTITION BY T.WebCategoryId ORDER BY T.WebCategoryId , T.WebSubCategoryId ,...

  • RE: how to convert seconds to time in sql

    Yes sure ! ( A + B )2 = A2 + B2 + 2AB! 😀

    On the other hand, convert to time = what?? time can be specified in...

  • RE: need help w/ my sort coulmn

    Thanks for setting up the data

    Here is my 2-cents 🙂

    ; WITH CTE AS

    (

    SELECT

    [sort]

    ,[InventoryItemId]

    ,[WebOptionName]

    ,[WebCategoryId]

    ,[WebSubCategoryId]

    ,AnchorRN = ( ROW_NUMBER() OVER ( PARTITION BY T.WebCategoryId...

  • RE: Query help

    SQL_Surfer (3/14/2012)


    Any help would be approciated.

    Sure. But help us first!

    There is menu card in that hotel! I want you to buy me a lunch from that menu card! Can you?

  • RE: Converting varchar to datetime

    How about this?

    Sample data

    DECLARE @Table TABLE ( DatetimeasVC VARCHAR(30) );

    INSERT @Table

    SELECT '10/28/2011 11:47:55.686455 AM'

    UNION ALL

    SELECT '9/28/2011 11:47:55.123455 AM'

    UNION ALL

    SELECT '11/12/2011 11:47:55.789455 PM'

    UNION ALL

    SELECT '10/9/2011 11:47:55.9996 AM'

    UNION ALL

    SELECT '1/26/2011 11:47:55.3456 PM'

    UNION...

  • RE: Converting varchar to datetime

    Lynn Pettis (3/14/2012)


    Or, if all things being equal:

    DECLARE @DatetimeasVC VARCHAR(30);

    set @DatetimeasVC = '10/28/2011 11:47:55.686455 AM';

    select convert(datetime,

    substring(@DatetimeasVC, 7, 4) + substring(@DatetimeasVC, 1, 2) +...

  • RE: Converting varchar to datetime

    in the link i posted for DATETIME and DATETIME2, look at the Element Range explanation. That will tel u why ur string is not getting converted. Basically u had more...

  • RE: Converting varchar to datetime

    ishaan99 (3/14/2012)


    I tried both doing a cast and convert still getting an error as

    Conversion failed when converting datetime from character string. This is what i tried:

    SELECT convert(varchar,convert(datetime,'1/6/2012 12:36:35.631951 PM'),100)

    That...

  • RE: Values into separate columns

    Gianluca Sartori (3/14/2012)


    Ah! Thanks Mr. Coffee!

    No problem, Gian!

  • RE: Values into separate columns

    Gianluca Sartori (3/14/2012)


    This should do the trick:

    SELECT *

    FROM (

    SELECT PartId,

    value,

    attribute = attribute + CAST( ROW_NUMBER() OVER(PARTITION BY PartId, attribute ORDER BY PartId, attribute) AS varchar(10))

    FROM (

    SELECT PartID,

    value =...

  • RE: Converting varchar to datetime

    This?

    DECLARE @DatetimeasVC VARCHAR(30) = '10/28/2011 11:47:55.686455 AM'

    SELECT CAST ( @DatetimeasVC AS DATETIME2) UsingCAST ,

    CONVERT(DATETIME2, @DatetimeasVC) UsingConvert

    You yourself said u want to convert, why...

  • RE: Contacenating Rows Into 1 Column

    FROM @TempComments p1 ) D ( R_FK_HeaderID, CommentDesc, seq )

    D is called table-alias.. This is dynamically assinging a name to a sub-query so that i can be referenced elswhere in...

  • RE: Contacenating Rows Into 1 Column

    There are lot of tables in the mix. I'm confused. But here is the code i use when i need to concatenate multiple rows into one single row.

    IF OBJECT_ID('TEMPDB..#CONCAT_COLUMN_VALUES') IS...

Viewing 15 posts - 406 through 420 (of 1,923 total)