Viewing 15 posts - 121 through 135 (of 898 total)
Neil.McKinnon (6/20/2013)
I did Abu, it returned the following error:"Msg 8152, Level 16, State 13, Line 1
String or binary data would be truncated.
The statement has been terminated."
The structure of your...
June 20, 2013 at 6:35 am
Vincy-856784 (6/20/2013)
Hmm. So, the only option I have is to get rid of the function since I was using LOWER(FRUIT) = 'apple'....
June 20, 2013 at 6:24 am
inevercheckthis2002 (6/20/2013)
Jan Van der Eecken (6/19/2013)
Just OUTER JOIN tableA, tableB and tableC on id_number.
Point of clarification -- sometimes data will be entered in TableA and not in TableB or TableC....
June 20, 2013 at 6:18 am
Can you also post the expected results based on your sample data along with a brief description of the logic?
It will help us to test the solutions before we post...
June 20, 2013 at 6:13 am
Do you find this simpler?
SELECTid,
MAX( CASE WHEN characteristic = 'color' THEN value ELSE NULL END ) AS color,
MAX( CASE WHEN characteristic = 'age' THEN value ELSE NULL END ) AS...
June 20, 2013 at 5:35 am
I agree with the poster above
Going by the description that you have provided even I don't think there is any need for a CURSOR
Please post the table definitions, sample data...
June 20, 2013 at 5:19 am
WayneS (6/19/2013)
Kingston Dhasian (6/19/2013)
Sai Viswanath (6/19/2013)
One more doubt on partitioning.
- Do we need to have a primary key in the table which needs to be partitioned?
- Can I...
June 20, 2013 at 2:10 am
A CROSS TAB will give you the desired results
SELECTControlNo, MODELKEY,
SUM( CASE WHEN SEQ = 1 THEN InspInterval ELSE 0 END ) AS int0,
SUM( CASE WHEN SEQ = 2 THEN InspInterval...
June 20, 2013 at 1:23 am
marin-231997 (6/19/2013)
many thanks for your quick responses, much appreciated.
Kingston's solution is exactly what I am looking for - I did not know how to group by...
June 19, 2013 at 9:16 am
Krishna1 (6/19/2013)
June 19, 2013 at 8:58 am
Removed as it was a duplicate post
June 19, 2013 at 8:07 am
Something like this
DECLARE@startdate DATE
DECLARE@enddate DATE
SET@startdate = '20130701'
SET@enddate = '20130703'
SELECTT.ITEM, DATEADD(DAY, D.number, @startdate) AS Dt, SUM(T.QTY) AS QTY
FROM@t AS T
CROSS APPLY(
SELECT*
FROMmaster.dbo.spt_values AS sv -- You can use a Tally table instead...
June 19, 2013 at 8:00 am
SELECT * FROM customer WHERE customer.customerid in (SELECT customer.customerid FROM salesorder)
In the above query, the term customer.customerid references the customer table outside as the customer table is still in scope
For...
June 19, 2013 at 7:02 am
aaron.reese (6/19/2013)
you will get an error message
Select Customer.CustomerID from salesorder
table Customer has not been defined in the subquery.
Are you sure? Check this
CREATE TABLE customer
(
customerid INT
)
CREATE TABLE salesorder
(
customerid INT
)
INSERTcustomer
SELECT1 UNION ALL
SELECT2
INSERTsalesorder
SELECT1
SELECT...
June 19, 2013 at 6:32 am
Are you in the middle of some exam or is your exam over?
This does not seem to be some real time scenario that you are facing in your assignment.
June 19, 2013 at 5:58 am
Viewing 15 posts - 121 through 135 (of 898 total)