Viewing 15 posts - 331 through 345 (of 898 total)
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 26, 2013 at 2:25 am
Can you also provide the expected output based on your sample data?
That will help to understand your description better.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 26, 2013 at 1:51 am
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 26, 2013 at 1:41 am
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 26, 2013 at 12:57 am
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'...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 26, 2013 at 12:36 am
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 26, 2013 at 12:23 am
jrseven68 (3/25/2013)
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 25, 2013 at 11:14 pm
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 25, 2013 at 4:17 am
Is there a UNIQUE column(s) in your table tblOrderItems other than the IDENTITY field?
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 25, 2013 at 3:58 am
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 25, 2013 at 3:40 am
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 )...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 22, 2013 at 1:09 pm
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...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 22, 2013 at 12:34 pm
kapil_kk (3/22/2013)
Kingston Dhasian (3/22/2013)
If the column(s) are not part...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 22, 2013 at 8:05 am
Duplicate post
Please post further replies here
http://www.sqlservercentral.com/Forums/Topic1434157-391-1.aspx
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 22, 2013 at 7:00 am
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.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 22, 2013 at 6:58 am
Viewing 15 posts - 331 through 345 (of 898 total)