Viewing 15 posts - 1,591 through 1,605 (of 2,458 total)
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
You can get the schema, name and DDL for the stored procs from INFORMATION_SCHEMA.ROUTINES. Something like this...
DECLARE @buildSprocsScript nvarchar(max) ='';
SELECT @buildSprocsScript += 'DROP PROC '+specific_schema+'.'+specific_name+char(13)+'GO'+char(13)
+REPLACE(ROUTINE_DEFINITION,'<what you want to replace>','<replace...
-- Itzik Ben-Gan 2001
April 16, 2015 at 10:48 am
GilaMonster (4/13/2015)
Alan.B (4/10/2015)
-- Itzik Ben-Gan 2001
April 16, 2015 at 9:57 am
The book you listed is not a bad start at all. I actually own it but have not read it; as a DBA, however, I learned a ton from the...
-- Itzik Ben-Gan 2001
April 16, 2015 at 9:47 am
Ok, quick update... I did some research on this - it appears that sys.partitions does not guarantee an accurate row count. According to Microsoft, the rows column in sys.partitions "Indicates...
-- Itzik Ben-Gan 2001
April 10, 2015 at 4:26 pm
Viewing 15 posts - 1,591 through 1,605 (of 2,458 total)