Forum Replies Created

Viewing 15 posts - 331 through 345 (of 898 total)

  • RE: calculating period of time

    Using, sample data provided by Chris, this is probably what you need

    ;WITH MyData ([day], [Count]) AS (

    SELECT '2008-01-01 00:00:00.000', 3 UNION ALL

    SELECT '2008-01-01 11:00:00.000', 9 UNION ALL

    SELECT '2008-01-01...

  • RE: calculating period of time

    Can you also provide the expected output based on your sample data?

    That will help to understand your description better.

  • RE: calculating period of time

    It is difficult to recommend something based on the description only.

    It would be easier if you can provide some DDL of the tables involved, sample data and the expected results.

    Please...

  • RE: SQL Server 2008 Transaction log backup issue...

    Yes. There can be incoming transactions when a transaction log backup is in process.

    The backup will include the transactions even if they are uncommitted with appropriate status information so that...

  • RE: select 200 column out of 250 column

    You can run the below mentioned query to get the list of comma-separated columns.

    You can then copy the results and use them in your SELECT statement

    SELECTCOLUMN_NAME + ','

    FROMINFORMATION_SCHEMA.COLUMNS

    WHERETABLE_NAME = 'YourTableName'...

  • RE: select 200 column out of 250 column

    No. You will have to write the 200 columns in your SELECT statement.

    You can save some typing effort by using system tables like INFORMATION_SCHEMA.COLUMNS to generate comma-seperated column names and...

  • RE: SQL Query help

    jrseven68 (3/25/2013)


    Hey thanks.

    This works perfectly with what i am trying to do.

    The only down side to using this is it does not return results where userid's have 0 records in...

  • RE: Mapping Old identity values to new ones

    Assuming that the column combination of ItemTypeID, Service and OrderID is UNIQUE, the below code should do what you need

    INSERT[dbo].[tblOrderItems]( [ItemTypeID], [OrderID], [Service] )

    SELECT[ItemTypeID], @newOrderId, [Service]

    FROM[dbo].[tblOrderItems] A

    WHEREA.OrderID = @OrderID

    INSERT#temp_result( OldOrderItemID...

  • RE: Mapping Old identity values to new ones

    Is there a UNIQUE column(s) in your table tblOrderItems other than the IDENTITY field?

  • RE: difference betwwn inner join and intersect in sql

    No. They are not doing the same job. They are for entirely different purposes.

    Try looking up in Google or Books Online. You will easily get information on these topics.

    If you...

  • RE: SQL Query help

    This is probably what you need

    SELECTU.userid,

    SUM( CASE WHEN U.userid = P.whoverified THEN 1 ELSE 0 END ) AS whoverified,

    SUM( CASE WHEN U.userid = P.whochecked THEN 1 ELSE 0 END )...

  • RE: Column reference

    You can implement the same thing using triggers as well but constraints are better than triggers for such requirements.

    Moreover, I think what you need is a composite FOREIGN KEY constraint

    Check...

  • RE: Column reference

    kapil_kk (3/22/2013)


    Kingston Dhasian (3/22/2013)


    Yes. A FOREIGN KEY constraint has to be linked to either a PRIMARY KEY constraint or a UNIQUE constraint in another table.

    If the column(s) are not part...

  • RE: Column reference

    Duplicate post

    Please post further replies here

    http://www.sqlservercentral.com/Forums/Topic1434157-391-1.aspx

  • RE: Creating reference

    You will have to make VoucherNo a UNIQUE KEY in GV_Voucher table.

    Only then you will be able to create the desired FOREIGN KEY constraint.

Viewing 15 posts - 331 through 345 (of 898 total)