Viewing 15 posts - 2,221 through 2,235 (of 2,462 total)
Sean Pearce (6/26/2013)
Alan.B (6/25/2013)
Which is why I included two solutions: My original solution which I believe is correct and one which was cleaner and faster than the one Michael posted.
Do...
-- Itzik Ben-Gan 2001
June 26, 2013 at 5:10 am
J Livingston SQL (6/25/2013)
Alan.B (6/25/2013)
Michael Valentine Jones (6/25/2013)
select top 1
a.[Date]
from
(
select top 1 b.[Date] from table1 b order by b.[Date] desc
union
select top 1 c.[Date] from table2 c order by c.[Date] desc
)...
-- Itzik Ben-Gan 2001
June 25, 2013 at 2:43 pm
Michael Valentine Jones (6/25/2013)
select top 1
a.[Date]
from
(
select top 1 b.[Date] from table1 b order by b.[Date] desc
union
select top 1 c.[Date] from table2 c order by c.[Date] desc
) a
order by
a.[Date] desc
I think...
-- Itzik Ben-Gan 2001
June 25, 2013 at 1:47 pm
Shadab Shah (6/25/2013)
J Livingston SQL (6/25/2013)
Shadab Shah (6/25/2013)
Is there any easy way...
-- Itzik Ben-Gan 2001
June 25, 2013 at 12:48 pm
If you have db backed up as a single .BAK file then restoring the database is the only way I can think of; there is no way to dig around...
-- Itzik Ben-Gan 2001
June 25, 2013 at 9:39 am
Are you looking for something like this...
--(1) THE DATA
IF OBJECT_ID('ajbtest.dbo.PivotA') IS NOT NULL
DROP TABLE PivotA;
CREATE TABLE dbo.PivotA (IDT int, A int, B int);
INSERT dbo.PivotA VALUES (24,1,-1),(24,2,-2),(24,3,-3),(24,4,-4),(25,5,-5),(25,6,-6),(25,7,-8),(26,8,-8),(26,9,-9),(26,10,-10);
--SELECT * FROM dbo.PivotA;
--(2) THE...
-- Itzik Ben-Gan 2001
June 19, 2013 at 12:46 pm
sabah_seattle (6/14/2013)
Thanks for responding. Here is the error I am getting -
An error occurred during local report processing
An error has occurred during report processing.
Query execution failed for dataset "Sales".
Login...
-- Itzik Ben-Gan 2001
June 17, 2013 at 9:32 am
HowardW (6/13/2013)
You can write your own queries, using the DMVs, which is a good learning exercise, but I'd recommend using the brilliant sp_whoisactive.
I wanted to second that.
-- Itzik Ben-Gan 2001
June 13, 2013 at 9:55 am
To get rid of those dashes you could do something like this:
DECLARE @x XML,
@x1 varchar(1000)='
- <CLUB>
-...
-- Itzik Ben-Gan 2001
June 13, 2013 at 9:31 am
You would need to do something like this:
-- (1) SAMPLE DATA SETUP
IF OBJECT_ID('tempdb..#tblHoliday') IS NOT NULL
DROP TABLE #tblHoliday;
IF OBJECT_ID('tempdb..#dates') IS NOT NULL
DROP TABLE #dates;
--Holiday table, I only added New Years,...
-- Itzik Ben-Gan 2001
June 12, 2013 at 10:55 am
Ed Wagner (6/12/2013)
Depending on how you write it, this approach can be very efficient.
After...
-- Itzik Ben-Gan 2001
June 12, 2013 at 8:09 am
mike.dinnis (6/12/2013)
I have a table with five fields used to hold address data. Due to poor practices the users have been able to enter any data in any field. They...
-- Itzik Ben-Gan 2001
June 12, 2013 at 7:52 am
I have a solution that will work with your sample data. I was trying to come up with something that works when there are more than 3 records but this...
-- Itzik Ben-Gan 2001
June 7, 2013 at 3:31 pm
vxhughes (6/6/2013)
I've already started on
http://beginner-sql-tutorial.com/sql-commands.htm
and
http://www.w3schools.com/sql/sql_intro.asp
and I've bookmarked "Stairway to T-SQL DML" at
http://www.sqlservercentral.com/stairway/75773
A couple of quick questions:
• Which of Itzik Ben-Gan's T-SQL fundamentals books do I...
-- Itzik Ben-Gan 2001
June 6, 2013 at 12:53 pm
OTF (6/6/2013)
bgraham 64271 (6/5/2013)
SQLSACT (6/5/2013)
vxhughes (6/4/2013)
Can anybody recommend a good online guide to SQL commands? Or at least a list of the ones I should learn first?
Have a look...
-- Itzik Ben-Gan 2001
June 6, 2013 at 10:33 am
Viewing 15 posts - 2,221 through 2,235 (of 2,462 total)