Viewing 15 posts - 8,311 through 8,325 (of 14,953 total)
I have to say that the car analogy to software is, while tempting and poetic, horribly flawed.
First, a car really has one purpose, which is to get you from point...
September 28, 2009 at 3:00 pm
Patindex finds the first place that the substring appears. It nests that in Left, which gets everything up to that point. Then it replaces that in the string.
If...
September 28, 2009 at 2:49 pm
Are you using:
exec (@SQL)
or
exec @SQL?
The difference is the parentheses.
September 28, 2009 at 2:40 pm
The results of the script I posted should look something like this:
alter table dbo.MyTable alter column MyBitColumn bit null;
alter table dbo.MyTable alter column MySecondBitColumn bit null;
alter table dbo.MySecondTable alter column...
September 28, 2009 at 2:07 pm
You should be able to modify this to fit your needs:
/*
Multi-row string concat using XML and string functions.
Pretty slick trick. Got it from RBarryYoung and Lynn Pettis on SSC.
*/
if...
September 28, 2009 at 1:14 pm
There are (basically) two ways to do this:
;with CTE1 (Col1) as
(select 1 union all
select 2)
select Col1
into #T
from CTE1;
or
create table #T (
Col1 int);
;with CTE1 (Col1) as
(select 1 union all
select 2)
insert...
September 28, 2009 at 1:09 pm
Did you actually run the script from the results?
I tested it, and it reset the columns in my table to allow nulls.
September 28, 2009 at 1:06 pm
Steve: That looks like it's missing a close-paren on the string. Or am I missing something?
September 28, 2009 at 12:15 pm
Take a look at xp_cmdshell. That allows you to run command prompt batches/commands from T-SQL.
Be warned that it does create security risks if you turn that on. (It's...
September 28, 2009 at 12:13 pm
That looks correct.
Test data would just be a matter of posting an insert statement with a few rows (5 or 10 is usually enough).
Generally, I leave that kind of summary...
September 28, 2009 at 12:08 pm
Silverfox (9/28/2009)
GSquared (9/28/2009)
These two articles and their discussions cover the subject pretty thoroughly. If you haven't already, you might take a look at them:
Very good articles, the author does...
September 28, 2009 at 12:04 pm
select * from sys.systypes
Run that. It'll give you the type ID for every system data type.
September 28, 2009 at 12:02 pm
If you have the before and after data, there's a trick you can do with it that will give you the fields that changed.
create table #Before (
ID int identity primary...
September 28, 2009 at 12:01 pm
CTEs only apply to the statement they appear in.
What you would need to do is load the first CTE into a temp table, then the second, then the third.
If you...
September 28, 2009 at 11:50 am
Viewing 15 posts - 8,311 through 8,325 (of 14,953 total)