sql-server-2008

Indexes in a Data Warehouse

I'm creating a data mart in SQL Server 2008 using SSIS for load, and SSAS for an OLAP cube. So far, everything is working great. However, I haven't created any indexes on the source database other than the default clustering on primary key. I'm pretty comfortable with designing indexes on the application databases, but since this da...

"Invalid character value for cast specification" for linked 2008 SQL server in 2005 instance

I am attempting to create a linked server from a 2005 to 2008 Microsoft SQL Server. I do this regularly for 2005 instances, but this is the first step of my long journey into SQL 2008. I am able to create the linked server as any other linked server, I receive no errors, however any time I try to use the linked server for anything (a sim...

SQL Server 2008 : Standard or SQL Express

Which is a better choice on a development box if you primarily develop Asp.Net applications and SSRS reports. I have never had to use the Express editions, so I don't really know the pros or cons. The cons I have listed for Standard+ editions are: toll it takes on system resources pain to attach database for projects pain to detach un...

Weird trigger problem when I do an INSERT into a table

Hi folks, I've got a trigger attached to a table. ALTER TRIGGER [dbo].[UpdateUniqueSubjectAfterInsertUpdate] ON [dbo].[Contents] AFTER INSERT,UPDATE AS BEGIN -- Grab the Id of the row just inserted/updated DECLARE @Id INT SELECT @Id = Id FROM INSERTED END Every time a new entry is inserted or modified, I wish to update a si...

Disable Transaction Log

Oracle has SQL commands that one can issue so that a transaction does not get logged. Is there something similar for SQL Server 2008? My scenario: We need Tx logs on servers (Dev, QA, Prod), but maybe we can do without them on developer machines. ...

How do I increase the maximum allowed attachment size for email sent using msdb.dbo.sp_send_dbmail in Microsoft SQL Server 2005/2008

Symptom: Sending an attachment using msdb.dbo.sp_send_dbmail results in the following error: File attachment or query results size exceeds allowable value of 1000000 bytes How can I increase that value? ...

sql table udt, vs 2008, csharp

Hi, I am trying to run a SQL stored proc from Visual Studio 2008 which takes a table-valued UDT parameter as an input. I added this parameter in Visual Studio 2008 but when I run this program it gets an "ArgumentException - Specified type isn't registered on target server." So I googled this problem and think I need to create a new cla...

SQL Server 2008 Licensing when splitting Report Manager and Report Service on different machines

Question: If I install the Report Server webservice on machine A and I put the Report Manager web application on machine B ... do I need two licenses or just one? In other words, what constitutes installing SSRS 2008 on a given machine? Does the Reporting service = SSRS -OR- does any part of an SSRS install = SSRS with regards to lice...

How to output a column per group that an item is a member of?

Given this SQL Input Table GroupId Item 1 Fish 1 FishBowl 2 Fish 3 Fish How Can i derive this Output? Item IsInGroup1 IsInGroup2 IsInGroup3 Fish Y Y Y FishBowl Y N N Please note that the Number of Groups can be variable ...

SSRS 2008 Displaying Date Datetype correctly

I'm using SQL 2008 and SSRS 2008: CREATE TABLE [dbo].[DimDates]( [pkDateID] [int] NOT NULL, [FullDate] [date] NULL, [DayNumberOfWeek] [tinyint] NULL, [DayNameOfWeek] [varchar](9) NULL, [IsLastDayOfMonth] [char](1) NULL, [MonthName] [varchar](9) NULL, [CalendarDay] [smallint] NULL, [CalendarWeek] [tinyint]...

How should I test a field against an SQL variable which can be null ?

I've got the following SQL : CREATE TABLE tbFoo( a varchar(50) NULL, ) CREATE NONCLUSTERED INDEX IX_tbFoo_a ON tbFoo ( a ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) insert into tbFoo ...

SQL Server LOB data compression and full-text search

I have a SQL Server 2008 database with a large amount of varchar(max) data that is currently indexed with full-text search. Unfortunately, row-level compression in SQL Server 2008 does not support LOB data. I am toying with the idea of using SQLCLR to compress the data and a custom iFilter to enable the data to be indexed with full-text...

What are viable options for data synchronization and transformation in sql server 2008?

Our company needs to synchronize two sql server 2008 databases on two different servers. The database schemas are about 50% different so transformation is needed. Synchronization needs to be done in real time. Synchronization needs to be bi-directional. What are some good practices used for this purpose? We have analyzed the foll...

How can i speed up this Indexed View?

Hi folks, I have a simple Indexed View. When I query against it, it's pretty slow. First I show you the schema's and indexes. Then the simple queries. Finally a query plan screnie. Update: Proof of Solution at the bottom of this post. Schema This is what it looks like :- CREATE view [dbo].[PostsCleanSubjectView] with SCHEMABINDING ...

How to find where my data files and log files stored using smo in c#

Hi Can any body plz tell me how to find the location where my data and log files stored using SMO in c# Thanks in Advance ...

Catch and continue in SQLServer

I have this sql procedure: create procedure DELETE as DECLARE VARIABLES begin TRY DECLARE CURSOR FOR SELECT ANYTHING OPEN CURUPD FETCH NEXT FROM CURUPD INTO VARIABLES WHILE @@FETCH_STATUS = 0 BEGIN UPDATE TABLE BASED SON VARIABLES FETCH NEXT FROM CURUPD INTO VARIABLES END CLOSE CUR DEALLOCATE CUR end TRY begin catch DO NOT CARE ABO...

finding datafiles path including datafile name using SMO

Hi i have did like foreach(LogFile lf in db.Databases) Console.WriteLine(lf.FileName) which displays the logfile path including extension.....My Problem is how to find the Datafiles exact path including extension..Give me the Guidance Any Help is Greatly Appreciated... Thanks in Advance. ...

Table with a lot of columns

If my table has a huge number of columns (over 80) should I split it into several tables with a 1-to-1 relationship or just keep it as it is? Why? My main concern is performance. PS - my table is already in 3rd normal form. PS2 - I am using MS Sql Server 2008. PS3 - I do not need to access all table data at once, but rather have 3 dif...

how to migrate from sql 2000 to sql 2008 via restore?

I'm running this code: RESTORE DATABASE [MyDB_2009May11] FROM DISK = N'C:\DB Copy\MyDB_2009May11.bak' WITH MOVE N'Archive_Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\MyDB_2009May11.mdf', MOVE N'Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\MyDB_2009May11.mdf'...

Pattern for updating slave SQL Server 2008 databases from a master whilst minimising disruption

We have an ASP.NET web application hosted by a web farm of many instances using SQL Server 2008 in which we do aggregation and pre-processing of data from multiple sources into a format optimised for fast end user query performance (producing 5-10 million rows in some tables). The aggregation and optimisation is done by a service on a ba...