Forum Replies Created

Viewing 15 posts - 91 through 105 (of 205 total)

  • RE: Script for columns' name, data type, length for one table

    I got it.

    USE [DatabaseName]

    GO

    SELECT column_name 'Column Name',

    data_type 'Data Type',

    CHARacter_maximum_length 'Maximum Length'

    FROM information_schema.columns

    WHERE table_name = 'TableName'

    GO

  • RE: Select record from group

    Chris, thank you again. This is a magic.

    I need to learn

    "ROW_NUMBER() OVER(PARTITION BY ID ORDER BY COLOR) - AUTOID"

    Would you mind to explain more about this statement?

  • RE: Select record from group

    Thank you very much.

    This is exatly what I need.

    The last question is how to delete duplicate records before output?

    ID-------DATEFROM-----------------DATETO--------------------COLOR

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

    1112012-01-10 00:00:00.0002012-03-16 00:00:00.000BLUE

    1112012-01-10 00:00:00.0002012-03-16 00:00:00.000BLUE

    1112012-04-05 00:00:00.0002012-06-16 00:00:00.000GREEN

    1112012-04-05 00:00:00.0002012-06-16 00:00:00.000GREEN

    1112012-07-17 00:00:00.0002012-10-10 00:00:00.000BLUE

    1112012-07-17 00:00:00.0002012-10-10...

  • RE: Select record from group

    Here is my ddl. Please help.

    --===== If the test table already exists, drop it

    IF OBJECT_ID('TempDB..#mytable','U') IS NOT NULL

    ...

  • RE: Select record from group

    That is what boss whant.

    The sample data sort by DATEFROM but once COLOR change, it need to re-group and need min(DATEFROM) adn max(DATETO) again.

  • RE: Select record from group

    How to post ddl?

    I list the sample data and result I need again as below.

    Sample data:

    ID--DATEFROM-DATETO-----COLOR

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

    111 01/10/2012 01/11/2012 BLUE

    111 02/02/2012 02/02/2012 BLUE

    111 03/15/2012 03/16/2012 BLUE

    111 04/05/2012 04/05/2012 GREEN

    111 05/25/2012 05/26/2012...

  • RE: Select record from group

    No, this result is not right.

    If I use this query, the result is not same as I expected.

  • RE: List objects to move

    If I only need object's name, how to do it?

  • RE: List objects to move

    Thank you. It works.

  • RE: Delete datetime record

    This will delete entire row.

    What I need is to delete data in [ORDERDATE] cell and keep bbb in [NAME] field.

  • RE: Select statement can't modify

    If I change top 200 to top 1000, does this change only apply for my account?

  • RE: Select statement can't modify

    Thank you so much, richard.noordam

    This is just what I am looking for.

  • RE: Select statement can't modify

    richard.noordam, I just use your way but I am tired to change 200 every time.

    I just want to find a way to modify SQL server setting to make job easier.

  • RE: Select statement can't modify

    Not file. I just type in

  • RE: Pass inter year and month return last day of month

    Works like magic.

    Thanks

Viewing 15 posts - 91 through 105 (of 205 total)