sql-server-2008

Need help with Sql Server 2008 and Full Text Searching

Hi folks, I've setup a FTS on a single field, in a single table. Field: Name NVARHCHAR(350) NOT NULL Now, when i search for the following 1 ave 10 ave i don't get back the results i expect. Firstly, the search query 1 ave is transformed into "1*" AND "ave*". Now i run my CONTAINS(..) query... SELECT FooId, Name FROM [dbo].[Names...

Is it ever a good idea to store BLOBs in a database?

For a while I've been working on inserting the data from a bloated Excel workbook into a SQL database. My team has suggested keeping a backup of the .xls, and they are wondering if it might be a good idea to put the Excel workbook actually inside the database so that all the relevant data from our project was together. I know some datab...

Dynamically finding column values in a trigger from INSERT when the column name is a variable

I have a trigger that gets inserts and updates to a view. I need to find the columns that are being modified and get the value into the correct table. INSERT INTO TempTableAttr_Lot(ID, [% Num]) VALUES(3, 24.0) I am trying to figure out how, in my trigger, to get the value of ID and [% Num] columns. The problem is that there can be 32...

SSMS 2008 Task List

In SQL Server Management Studio 2008 there is a Task List very much like the one in Visual Studio, I can't seem to figure out how to put it to use nor can I find any documentation on it other than the documentation for Visual Studio which does not apply as the comment syntax is unique to TSQL... The Task List in SSMS 2008 is accessible ...

How to refactor a trigger that uses the inserted and deleted tables, to move common code to a stored procedure

I have a trigger that will be dynamically created, as it will be attached to a view that is also dynamically generated. I don't want my stored procedure to have the entire trigger within it, so I would like to move most of it to a stored procedure, but I won't know the fields in the inserted and deleted tables. The trigger is about 90 ...

Using integration service, how can I copy a record, with all the records that the main record has a foreign key relationship to

I am working on creating the necessary views, triggers and stored procedures so I can make it easier for people to use Integration Service to copy data to and from our database, which is an entity-attribute-value schema, so the foreign key relationships are not always explicitly stated in the schema, but in my view I can hopefully make i...

Order by integer with blank fields at the bottom.

Hi, We're rewriting our CMS at the moment and we want our clients to be able to re-order items in a table using a "position" field. So, if they mark an items as position 1 it goes at the top, then position 2 underneath it etc. The problem is that we don't want to them to have to fill in a position every time, only if they want to re-or...

SQL Server 2008 Performance: No Indexes vs Bad Indexes?

Hey guys, i'm running into a strange problem in Microsoft SQL Server 2008. I have a large database (20 GB) with about 10 tables and i'm attempting to make a point regarding how to correctly create indexes. Here's my problem: on some nested queries i'm getting faster results without using indexes! It's close (one or two seconds), but i...

how to install SQL Server job using scripts?

Hello everyone, I have a SQL Server job in my SQL Server 2008 server. Now I want to write some scripts using PowerShell which could deploy the job into other computers automatically through command line. Any samples or documents to recommend for this topic to learn? thanks in advance, George ...

Reporting Services Subscriptions won't allow modification of the To: Field

I have a little issue that is causing me a headache. Our Report Server is SQL Ent 2008 on a Win 2008 server. When users that have Report Browser permissions try to set up a report subscription the To: field is grayed out and pre-populated with their username. They cannot change this and it won't deliver to their email address which wo...

How to reclaim space after turning on page compression in SQL 2008?

I have just turned on page compression on a table (SQL 2008 Ent) using the following command: ALTER TABLE [dbo].[Table1] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE ) The hard drive now contains 50GB less space than before. I'm guessing that I need to run a command to reclaim the space. Anyone know it? ...

Problem with search query in my Sql Server stored proc

Hi folks, I have the following stored proc :- SELECT Id, Name FROM FooBars WHERE CONTAINS(Name, 'FORMSOF(Tesaurus, @query)') Works fine when there is one word i the query: eg. foo* But it fails when I want to have more than one word which i'm trying to look for. eg. foo* bar* (this means any rows that have words that start with foo a...

Does Sql make implicit rollback if my rollback timeout?

I have a dotnet applicaton that executes a set of insert,update,delete statements in transactionaly manner The code is like this try { mytrans = mycon.begintransaction(); //execute sql statements mytrans.commit(); } catch(Exception) { mytrans.rollback(); } The problem is that sometimes we faced timeout exceptions in rollback and I fo...

Change language of error messages in SQL Server Management Studio

Hi all, I'm using SQL Server Management Studio 2008 to write a bunch of queries. I have installed French versions of Windows XP and SQL Server thus all SQL error messages appear in French. I would prefer to see the error messages in English. Any idea how to change the language of the error messages? I won't reinstall the machine. ...

SQL Server2008 Installation on Windows Vista (Performance Counter Error)

Hi there, I am having a hard time when installing SQL Server 2008, it complains that my performance counter registry hive consistency, and gave me a link as follows: http://support.microsoft.com/kb/300956 Cool, first step, not possible to do, asked me for a CD of Vista, my laptop comes with an OEM version of vista, no CD provided, boo...

Adding a Node to a SQL Server 2008 Cluster Returns "The current SKU is invalid." Error

When I try to add a second node to my SQL Server 2008 cluster the installer throws an error, "The current SKU is invalid." What's up I know the key is correct, I used it on the first node? ...

Find out FILESTREAM share name in T-SQL

Real quick question - I must be blind or something. In SQL Server Mgmt Studio, I can check for the level of filestream support currently enabled by EXEC sp_configure filestream_access_level Great, works. But how can I find the Windows share name specified during installation where the filestream data will actually be stored? I can't...

Color coding SQL Server 2008 databases

I often have multiple databases open in SQL Server 2008. Often they are prod, dev, and dr. It is annoying because each window says something generic like SQLQuery1.sql... (sa(200))*. So I have to hover over the tab and make sure I am in the correct window. Is there a way to color code each window, or in some way to make it instantly kno...

SQL Server 2008: When can I NOT modify table structure? When can I not delete a row?

A couple of summers ago I worked for company that needed an Access DB designed for their sales and record keeping. One thing that bugged me during that summer was sometimes not being able to change the datatype of a column, delete a column, or delete a row (entry). And, if memory serves me (this was five years ago), I think I sometimes c...

SQL Server 2008: How to load/parse a SQL script from within TSQL?

Been working with SQL Server since it was Sybase (early 90s for the greenies) and I'm a bit stumped on this one. In Oracle and DB2, you can pass a SQL batch or script to a stored procedure to test if it can be parsed, then execute conditional logic based on the result, like this pseudocode example: if (TrySQLParse(LoadSQLFile(filename...