Viewing 15 posts - 1,576 through 1,590 (of 2,458 total)
Was stuck trying to do without cte/subquery... Using my sample data above:
SELECT
Col1 = ISNULL(a.name,b.name),
Col2 = CASE ISNULL(a.name,'') WHEN '' THEN 'Table B' ELSE 'Table A' END
FROM @tableA...
-- Itzik Ben-Gan 2001
April 20, 2015 at 10:42 am
I was thinking....
DECLARE @tableA TABLE (id int, name varchar(20));
DECLARE @tableB TABLE (number int, name varchar(20));
INSERT @tableA VALUES
(101,'Dante'),
(102,'Henry'),
(103,'Harold'),
(104,'Arnold');
INSERT @tableB VALUES
(102,'Dante'),
(107,'Gilbert'),
(109,'Harold'),
(110,'Arnold'),
(106,'Susan'),
(112,'Marian');
WITH names AS
(
SELECT a = a.name, b = b.name
FROM @tableA...
-- Itzik Ben-Gan 2001
April 20, 2015 at 10:17 am
Great article Sam. Simple, to the point, easy read - well done sir!
-- Itzik Ben-Gan 2001
April 20, 2015 at 9:35 am
I could be wrong but I don't think so. To my knowledge the wizard is only available when you select "New Report".
-- Itzik Ben-Gan 2001
April 18, 2015 at 1:08 pm
I was a DBA turned developer in 2010. I like administration but love development. If you are interested in a career as a SQL Developer you should consider getting up...
-- Itzik Ben-Gan 2001
April 18, 2015 at 1:00 pm
sandy.alvarez (4/17/2015)
BMC_CORE_BMC_BaseElement.Name, BMC_CORE_BMC_BaseElement.instanceid,BMC_CORE_BMC_BaseElement.reconciliationidentity
FROM ARSystem.dbo.BMC_CORE_BMC_BaseElement BMC_CORE_BMC_BaseElement (NOLOCK)
WHERE BMC_CORE_BMC_BaseElement.DatasetId='BMC.ASSET' AND
BMC_CORE_BMC_BaseElement.createdate>='2014-01-01' AND
BMC_CORE_BMC_BaseElement.createdate<='2014-12-31' AND (
BMC_CORE_BMC_BaseElement.submitter='syl'OR
BMC_CORE_BMC_BaseElement.submitter='salv'OR
BMC_CORE_BMC_BaseElement.submitter='aj') order by 1
You're missing a SELECT statement. Using NOLOCK removes the guarantee that...
-- Itzik Ben-Gan 2001
April 17, 2015 at 7:07 pm
dmodersk (4/17/2015)
First, a temp result set is created with all the rows...
-- Itzik Ben-Gan 2001
April 17, 2015 at 2:04 pm
I have not worked with SQL Server HA technologies (clustering, mirroring, replication, Log Shipping) since I was a DBA but I'll give you a few questions and the thinking behind...
-- Itzik Ben-Gan 2001
April 17, 2015 at 1:37 pm
Ok, I put together some DDL and sample data... I screwed up the aliases a little compared to what you have but this should still suffice. What you are doing...
-- Itzik Ben-Gan 2001
April 17, 2015 at 1:02 pm
DDL and sample data?
-- Itzik Ben-Gan 2001
April 17, 2015 at 12:33 pm
Excellent, glad that worked for you.
-- Itzik Ben-Gan 2001
April 17, 2015 at 12:30 pm
With respect to records that are duplicated, let's say you only wanted the one with the most recent
To get the records with the oldest Export date you could do...
-- Itzik Ben-Gan 2001
April 17, 2015 at 12:16 pm
I'm assuming you want your query results to include the Export date? and if so which record to you want keep (e.g. the one with the earliest Export date? oldest?)
-- Itzik Ben-Gan 2001
April 17, 2015 at 12:01 pm
Nope, not that I am aware of. Not without using a sp_cmdshell or other non-tsql scripting tool
What's wrong with this?
SELECT
DbName = db.name,
FileType = CASE...
-- Itzik Ben-Gan 2001
April 17, 2015 at 11:54 am
Katerine459 (4/16/2015)
-- Itzik Ben-Gan 2001
April 16, 2015 at 9:16 pm
Viewing 15 posts - 1,576 through 1,590 (of 2,458 total)