Viewing 15 posts - 1,591 through 1,605 (of 2,462 total)
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
Okay, I can't come up with a pure set-based way to handle this but I have a solution that I think is pretty slick using a recursive CTE wrapped in...
-- Itzik Ben-Gan 2001
April 16, 2015 at 9:03 pm
I really like the way you think. Unfortunately UPDATE does not work the way you are trying to use it.
Your DDL is bad and some sample data for questions...
-- Itzik Ben-Gan 2001
April 16, 2015 at 7:43 pm
Can you include ddl and sample data for #test
-- Itzik Ben-Gan 2001
April 16, 2015 at 5:35 pm
Jeff Moden (4/16/2015)
Alan.B (4/16/2015)
If that's not an option, and if Lowell's solution (enable xp_cmdshell then disable when...
-- Itzik Ben-Gan 2001
April 16, 2015 at 4:26 pm
What about a SQL Agent job that kicks off a script? Powershell perhaps?
If that's not an option, and if Lowell's solution (enable xp_cmdshell then disable when you're done) does...
-- Itzik Ben-Gan 2001
April 16, 2015 at 4:12 pm
spaghettidba (4/16/2015)
In windows the line separator is CR+LF. In linux it's LF.CR = CHAR(13)
LF = CHAR(10)
Got it. Thanks!
-- Itzik Ben-Gan 2001
April 16, 2015 at 3:11 pm
spaghettidba (4/16/2015)
SELECT
ISNULL(SAD.HOUSENUMBER + CHAR(13) + CHAR(10),'') +
ISNULL(SAD.ADDRESS1 + CHAR(13) + CHAR(10),'') +
ISNULL(SAD.ADDRESS2 +...
-- Itzik Ben-Gan 2001
April 16, 2015 at 3:02 pm
Good job with the DDL but to get a better answer it would be helpful if you could include some sample values so that we can better understand what you...
-- Itzik Ben-Gan 2001
April 16, 2015 at 2:50 pm
What do you mean by "Partition Column"?
Partition get's used in many contexts: Partition key, Partitioned table... A partition key is generally a non-distinct value/key that is used to group...
-- Itzik Ben-Gan 2001
April 16, 2015 at 2:41 pm
Looks like you have duplicate column names in both tables but you are not using a table alias
You query should look something like this:
SELECT a.col1, a.col2, b.col1
FROM a
Join
(
<Subquery>
) AS...
-- Itzik Ben-Gan 2001
April 16, 2015 at 1:21 pm
My observation is that an implicit conversion happens when you concatenate the two strings but it tops out at 8000.
Declare @VariableA varchar(100);
Declare @VariableB varchar(100);
SET @VariableA = REPLICATE('x',100);
SET...
-- Itzik Ben-Gan 2001
April 16, 2015 at 12:44 pm
Viewing 15 posts - 1,591 through 1,605 (of 2,462 total)