sql-server-2005

Sql Server Full Text Search - Getting word occurances/location in text?

Hi all. Suppose I have Sql Server (2005/2008) create an index from one of my tables. I wish to use my own custom search engine (a little more tuned to my needs than Full Text Search). In order to use it however, I need Sql Server to provide me the word positions and other data required by the search engine. Is there anyway to query t...

Problem Loading SSIS Custom Connection Manager/Type

I'm currently trying to build a custom connection manager and custom data flow source for a proprietary system at work, and I'm running into an odd problem when I attempt to execute a task containing my custom manager (from BIDS, DTEXEC, or the agent) Error: 0xC0014005 at : The connection type "AF" specified for connection manage...

C# + Sql Server - Execute a stored procedure large number of times. Best way?

Hi all. I have one stored procedure which inserts data into 3 tables, (does UPSERTS), and has some rudamentary logic. (IF-THEN-ELSE) I need to execute this Sproc millions of times (From a C# app) using different parameters and I need it to be FAST. What is the best way to do so? Does anybody know an open-source (or not) off the shelf...

Should I explicitly "SET IDENTITY_INSERT [Table] OFF" after turning "ON"?

Does SET IDENTITY_INSERT [Table] ON persist beyond the scope of a SQL Script? I'm wondering if I need to explicitly set it to "OFF" or if SQL Server knows that it should only use that setting for the current script. Thanks! ...

Does SqlDbType.DateTime not store seconds?

The environment I am using is C# 3.5, ado.net, sqlserver 2005. using System.Data; using System.Data.SqlClient; I am using a SqlCommand cmd.Parameters of SqlDbType.DateTime to create a record in the database. Seconds are not being stored in the database. The field in the db is of type datetime. Do I need to do something special to ...

Recompile stored procs?

Is there a way to re-compile or at least 'check compile' stored procedures en masse? Sometimes we'll make schema changes - add or drop a column, etc. And do our best to identify affected procs only to be bitten by one we missed, which pukes when it runs next. SQLServer 2k5 or 2k8. ...

SQL Server 2005 Reporting Services Matrix Total Data Highlighting

I have created a SQL Server 2005 matrix with a total column. I want to be able to change the colors of the totals only so they stand out from the rest of the data. I can change the color of the "total" label, but not the actual data. Can anyone give me a clue of how to do this? ...

SQL Server Login Configuration and Automation

What's a good way to manage and maintain SQL Server logins, server roles, and individual access rights across multiple databases that exist in multiple environments? What are your best practices? Some info about my situation: SQL Server 2005 We have N amount of "client" databases with identical schemas (in theory, at least) We have a ...

Multiple Versions of SQL Server using Entity Framework in a single ASP.NET application

I am using the Entity Framework in a web application that utilizes SQL server 2000, 2005, and 2008. When I create a new EDMX file using anything other than 2008 (version of the first edmx created) I receive error 0172: All SSDL artifacts must target the same provider. The Provider 'MyDatabase' is different from ' MyDatabase ' that was en...

Save HTML (as is) to SQL 2005 table

Given the following HTML "<b>demo</b>" I want to save it to an SQL 2005 table Mandatory, no encoded, no escaped characters in the saved field from database Saved html must be as small as possible On my efforts, my stored html is always saved as encoded &gt; html EDIT: Debugging my code I found that my HTML string is sended encoded to m...

Same query uses different indexes?

Can a select query use different indexes if a change the value of a where condition? The two following queries use different indexes and the only difference is the value of the condition and typeenvoi='EXPORT' or and typeenvoi='MAIL' select numenvoi,adrdest,nomdest,etat,nbessais,numappel,description,typeperiode,datedebut,datefin,codeet...

Dictionary table relationships (MS SQL 2005)

I have table named 'Dictionary' with columns as follow: ID bigint TYPE varchar (200) ITEM varchar (200) Table is used by various tables as simple dictionary / lookup. Eg it stores countries, titles, business type lists. TYPE column keeps info about type of dictionary , ITEM is dictionary string value. All works well but I ha...

Can i use column number instead of column name in where condition of a select query in SQL Server 2005?

hi, can we use column number instead of column name in where condition of a select query in SQL Server 2005 so that even if the column name is so long. thanks in advance. ...

Returning multiple rows from a single row

This may not be possible, but I thought I'd throw it out here: Given the following table: ID, Begin, End 123, 1, N Where N is an integer, write a query to return the following result set: ID, Begin, End 123, 1, 1 123, 1, 2 123, 1, 3 . . . 123, 1, N The platform we are using is SQL Server 2005, but if you can do it with another flavo...

Group records and put results into single field

I have the following recordset: ID AssetName 882 Training Room VCR 882 Training Room DVD 882 Training Room TV 858 Training Room VCR 858 Training Room Computer 858 Training Room TV I want to group each ID and get a resultset as such: ID Assets 882 Training Room VCR<br/>Training Room DVD<br/>Training Room TV 858 Training Room...

lookup task (ssis)

I just need the confirmation. Tell me if I am wrong. A package consists of an oledb source editor which consists of a query followed by three lookups. If I do a preview on each task, every task (oledb source, and the first two lookups) except for the last lookup has values in the respective tables. So, my claim is: if there is no data ...

Grant Symmetric Key access to only 2 users

I'm trying to create a symmetric key in SQL Server 2005 and restrict it to just the sa and application user accounts. All other accounts should get an error when trying to open it. Here's how I'm creating it. I changed the names for the purposes of this question. CREATE CERTIFICATE My_Certificate WITH SUBJECT = 'My Cert Subject'; G...

Performance Issue with Distributed Queries

Hi, the code below works fine but it takes an absolute age to run. How can I speed this up? Background: I have linked my local server to my remote server. From my local server, I need to insert data from the remote server into my local server and then update the table on my remote server. See snippet for the exact details. DECLARE @tem...

Periodic restarting auto numbering for SQL Server

I have a requirement for a program I'm working on to store job numbers as YY-###### with incrementing numbers starting at 000001 in each year preceded by the last two digits of the year. The only method I've been able to come up with is to make a CurrentJob table and use an identity column along with the last two digits of the year an...

Looking for exercises to learn SQL, using the Northwind database

I am trying to become more familiar with SQL by writing queries against the Northwind database. I am looking for some exercises that would help me to learn SQL and features of SQL Server. It is important that the exercises have solutions, and in complicated cases, it would be great if there was an explanation for the query. Thanks ...