SQL Server

Virtualizing SQL Server, some tips.

I just got these considerations about virtualizing SQL Server on VMWare from my Boss and I would like to share them with you. General comments on problems encountered and why people not virtualizing SQL Storage ( most people just do not have enough spindles to start with and then when people consolidate they use less spindles not more, error in design and understanding of basic i/o principles ) Queue lengths are a problem so add as many paths to storage as possible. Using vmware makes sequential reads...

T-SQL copy and clone an existing table.

Something really useful that I like in Microsoft Access, is the capacity to select and clone an object just with a menu command. The options we have in access are: Structure only – will copy/paste into a new table the table structure, so the index, the primary key and so on. Structure and Data – will copy/paste everything inside a new table. Append – will copy the data into the existing cloned object. What can we do with SQL Server? Of course with SQL Server we cannot simply do that, especially...

Reporting Services 2008 book.

Today I would like to spend some rows about a great book I have purchased on www.Amazon.com. The book is Microsoft SQL Server 2008 Reporting Services and the author is Brian Larson, edited by MC Graw Hill. This is the direct link: book on amazon. Let's spend just few words about. First of all in my opinion the book is really great because it covers all the section of reporting services, it doesn't exclude nothing, really! Second point is the approach. Brian explain every report, step by step, by including some designer issue and trouble you can...

Install TFS 2008 on Windows Server 2008

Last week I decided to buy the TFS license for the TFS 2008. After 2 days and a lot of headaches I decided to follow step by step the official guide which is available here: Team Foundation installation guide and to be honest, if you follow, step by step the guide, you will have a full working version of TFS. Also my MVP friend Simon Chiaretta suggested me to use the official guide. This short guide will show you how to install a stand alone version, this means, a single server version which will contains: WSS 3.0, SQL Standard 2008...

SSIS, write message for interacting with the user.

SSIS, Sql Server Integration Services, is a full functional development environment. Unfortunately when we are building a package, before register and release the package, we need to Log, trace or debug the script. This process is a MUST if we are using a script task, a task which give you the availability to work directly with C# or VB.NET. Package Example. Create a simple SSIS project and insert a Sequence Container, then in the sequence container insert a Script Task and choose the C# language. Please don't take care about my screenshot, I know the package fails,...

SQL Server, how to implement FULL TEXT search.

One of the most useful function that I like in SQL Server is the FULL TEXT search. When you have a table or some tables with string fields, like VARCHAR or NVARCHAR, you know that running LIKE clause is CPU consuming. In order to run this example you must before activate the FULL TEXT search capability in your SQL engine. To do that: Open the SQL Server surface area configuration. Open the Services and Connections page. Configure the service to be enable. Now you...

SQL server, write correlated subqueries.

A subquery is a query that is nested into another query. When you work with T-SQL you have different ways to use subqueries, and every method has different performance results. Our example is a Database with two tables, take a look on the image below:  In this case we have a main table Employee with a one-to-many relation to the Address table. Where value IN. (non correlated example) The first query I want to show you is: 1: SELECT ...

SQL SSIS, insert only new rows.

SSIS workflow is really amazing when you have to add some automatism in your data flow processes. But sometimes is better to make same checks before start with a really dangerous BULK operation. One of the most noise stuff I have to do is to launch insert of new records when I receive updates from web (web services, XML data). But when I do this I'm always afraid about duplicated rows. Ho to check if a row exist, in SSIS? SSIS Package contains a component called lookup. Very intuitive name. So if you need to insert only...

Write intelligent query with if exist ... drop.

Usually when we build a query we start the .sql file, or command in the query editor with a simple command ... CREATE PROCEDURE ... bla bla bla. Ok but if I'm building a database from scratch is very probably that my procedure will be modified a lot of time. So every time we have to launch the command DROP PROCEDURE, or ALTER PROCEDURE. This sounds good if you are building your object. But in case of you want to store as a BACKUP PROCEDURE some scripts in the network, is better to produce this scripts as ATOMIC...

SQL 2005 and Linked server (Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO")

If you have a SQL 2005 machine with a (x64) installation, some of the system queries have a different name, like [some_command]sys_64. So when you try to connect your powerfull SQL2005 to an old remote SQL2000, probably in x32 version, you can receive a strange error like Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO". In many forums you can find a link to a microsoft KB that explains to you that you have to install the SP4 in the old SQL and maybe everything will done. Usually I like to know why something doesn't run ... So, when you execute from SQL2005 a...

Full SQL Server Archive