Viewing 15 posts - 3,331 through 3,345 (of 4,085 total)
I don't know if it's "better" than a CTE, but you can use CROSS APPLY
select
A,
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 8, 2012 at 8:00 am
Peter Brinkhaus (2/7/2012)
As an alternative, you could use NOT EXISTS (SELECT [@Stag].* INTERSECT SELECT [@Prod].*) to compare rows.
Using EXCEPT should give you the same results, is probably more efficient, and...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 8, 2012 at 7:22 am
You need to make sure that your literal string is Unicode. Compare the following results where the first literal is ASCII and the second is Unicode.
SELECT 'A a A...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 1, 2012 at 9:04 am
Take a look at EXCEPT which performs a set difference, which is what you are looking for. It makes it much clearer that you are doing a set difference...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 1, 2012 at 8:43 am
The SQL query is first compiled and then executed. Some SQL statements will allow you to use optimistic name resolution to refer to objects that have not yet been...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 30, 2012 at 7:50 am
Use an OUTER APPLY
SELECT m.[property_id]
,m.[Address]
,m.[City]
,m.[Zip]
,m.County
,m.Bedrooms
,m.Bathrooms
,m.HalfBathrooms
,m.[V_O]
,m.[Stars]
,m.Rehab
,m.Open_bid
,m.Notes
,m.date_time_changed
,i.imagepaththumb
FROM [Master] m
OUTER APPLY (
SELECT TOP (1) impagepaththumb
FROM Image
WHERE property_id = property_id_fk
) AS i
where Active_Month='Y'
ORDER BY m.[V_O] DESC
,m.date_time_changed desc
,m.[Address] ASC
You could also use ROW_NUMBER(), but I...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 30, 2012 at 7:06 am
Martin Schoombee (1/27/2012)
Take note though that it would require a triangular join, which is generally bad for performance.
I wouldn't classify this as a triangular join. A triangular joins assumes...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 27, 2012 at 8:03 am
mbrady5 (1/26/2012)
How would you like to see some sample data? What format etc?
See the following link.
Forum Etiquette: How to post data/code on a forum to get the best help[/url]
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 26, 2012 at 11:30 am
In addition, I think you need to change the comparisons on these.
Datediff(dd,receivedDate,getdate()) >= b.Days
AND Datediff(dd,receivedDate,getdate()) < b.Days - 5
By the law of transitivity, if n > d and d...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 26, 2012 at 9:15 am
Guras (1/26/2012)
I have a table as following TableA
clientcode | days
101 | 30
101 | 60
105 | 15
I need to build the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 26, 2012 at 9:06 am
Don't construct SQL commands in SSRS. Create a stored procedure and pass the SSRS parameters into the stored procedure.
Do you really need both a FULL OUTER JOIN and a...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 26, 2012 at 8:42 am
You're WHERE clause is not SARGable, because of the conversion of the timestamp field to character. Functions on fields generally prevent them from being SARGable, meaning that you cannot...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 25, 2012 at 9:46 am
Joe's posts on here have convinced me never to buy his books. He believes that he is being authoritative when he's just being authoritarian. He states opinion as...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 25, 2012 at 7:26 am
SJTerrill (1/23/2012)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 23, 2012 at 12:09 pm
It's simple. Check out the following webpage on Precision, Scale, and Length.
Specifically it says that datatypes other than decimal have a fixed precision and scale. The scale for...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 23, 2012 at 10:04 am
Viewing 15 posts - 3,331 through 3,345 (of 4,085 total)