Viewing 15 posts - 1,501 through 1,515 (of 3,008 total)
For the dynamic SQL approach:
declare @sqlnvarchar(4000)
set @sql =
'
INSERT INTO '+
case
when @PeriodType = 'Monthly'then N'Monthly_Summary_Data'
when @PeriodType = 'Daily'then N'Daily_Summary_Data'
else null end
+' (Column_1, Column_2, etc.)
SELECT
Source_col_1,
Source_col_2
FROM
SourceTable
'
exec sp_executesql @sql
February 2, 2010 at 10:03 am
Little late to point it out, but any good backup plan should have backups to tape to make sure you have some place to go back to.
January 29, 2010 at 4:07 pm
Lynn Pettis (1/27/2010)
Michael Valentine Jones (1/27/2010)
WayneS (1/27/2010)
Michael Valentine Jones (1/27/2010)
With the first format, only...
January 27, 2010 at 3:50 pm
WayneS (1/27/2010)
Michael Valentine Jones (1/27/2010)
With the first format, only the YYYYMMDD part is required,...
January 27, 2010 at 3:37 pm
There are two datetime string formats that are interpreted correctly with with any language setting.
With the first format, only the YYYYMMDD part is required, but with the second...
January 27, 2010 at 1:40 pm
declare @FirstPayDate datetime
set @FirstPayDate= '20100101'
select
*,
FirstPayDateOfCurrentQuarter =
dateadd(dd,(datediff(dd,@FirstPayDate,dateadd(dd,13,
dateadd(qq,datediff(qq,@FirstPayDate,Date),@FirstPayDate)))/14)*14,@FirstPayDate)
from
(
select Date = convert(datetime,'20100727')union all
select Date = convert(datetime,'20100827')union all
select Date = convert(datetime,'20101001')
) a
order by
a.Date
Results:
Date ...
January 25, 2010 at 2:24 pm
Create the view using "WITH SCHEMABINDING" in the other database.
January 20, 2010 at 7:59 am
Create the view using the "WITH SCHEMABINDING" option.
January 19, 2010 at 10:16 am
Trailing digits would not cause an Arithmetic Overflow error. See example code below.
create table #t ( MyNumber numeric(19,6) not null)
insert into #t select 10.641111111111 * 10.64373737469083459
select * from...
January 19, 2010 at 8:39 am
Stay away from #2. That's an EAV (Entity/Attribute/Value) model.
It saves a little work up front in data modeling by allowing "open ended" insertion of new attributes at the cost...
January 18, 2010 at 3:07 pm
crainlee2 (1/16/2010)
Thank you for your contributions on using CHECKSUM as a way of searching for equalities on VARCHAR(MAX) datatypes.
I think there are a few places in our...
January 17, 2010 at 10:38 pm
If you really need to do an exact match lookup on a varchar(max) column, you can add a computed column that contains a checksum of the varchar(max) column, and index...
January 16, 2010 at 12:49 am
In many cases, you can resolve deadlocks by setting the database to read_committed_snaphot as the default isolation level.
ALTER DATABASE [MyDatabase] SET ALLOW_SNAPSHOT_ISOLATION ON;
ALTER DATABASE [MyDatabase] SET READ_COMMITTED_SNAPSHOT ON;
Using Row Versioning-based...
January 15, 2010 at 3:06 pm
Just build the cluster with a new name. In a true disaster recovery, you can rename the cluster using the procedure below.
How to: Rename a SQL Server Failover Cluster...
January 15, 2010 at 2:53 pm
You could do this:
1. Create another admin login and use that one, so that it won’t matter if the SA login is locked out.
2. Change the name of the SA...
January 14, 2010 at 12:17 pm
Viewing 15 posts - 1,501 through 1,515 (of 3,008 total)