sql-server-2005

Can a stored procedure edit a XML file on the file system?

Is there a way for a SQL 2005 stored procedure to open a XML file in the file system (for exampe C:\Temp\Test.xml ) and edit a value within that file? I am working with a SQL 2005 database (containing metadata) that stores XML data separately in files (instead of using built-in SQL XML features). ...

SQL Server 2005 Full-text search: Noise Words

Using ContainsText, If I search: "Report Part 1" in quotes it returns the correct result (Report Part 1). However, if I search: Report Part 1 it gives me zero results. My understanding was that full-text would take out the 1 as a noise word, and then do a search for contains Report and Part. I assumed that the results would give me Rep...

Add a job step in SQL Server 2005

Hi, I have a questions about creating a SQL Job. Can somebody please let me know that how we can add a job step in the middle. Like if I want to add a step between step 2 and step 3. I would really apprecaite it. Thanks, ...

WCF: Efficiently consuming large numbers of singleton requests via SQL job?

I'm planning to build a console app to run as part of a SQL 2005 job which will gather records from a database table, create a request object for a WCF service, pass this object to the service for processing, receive a response object, and update a log table with its data. This will be for processing at least several thousand records eac...

Is COALESCE the best way to achieve this?

Hi everyone, Just want to see if anyone has a better way to accomplish what I need. First a background. I have a table in my database that currently has about 20,000 rows. In the table we have a column for FirstName and LastName. There is also a column that is a ReferenceID. There can be multiple FirstName, LastName combinations for ea...

Which SQL Query is Better?

Is this SQL query statement: SELECT p.id, p.[name], SUM(ps.sales_amount) AS GROSS_SALES FROM products p LEFT OUTER JOIN product_sales ps ON p.id = ps.product_id GROUP BY p.id, p.[name] better than: SELECT SUM([t2].[value]) AS [SalesAmount], [t2].[id] AS [ProductId], [t2].[name] AS [ProductName] FROM ( SELECT ( SELECT SU...

Storing .dll files in SQL Server 2005

Where can I find information on storing ".dll" files in SQL Server 2005? Is it the same as storing Binary data? ...

Getting All the record of particular month - Building SQL Query

Hi all, I need some help to build SQL Query. I have table having data like: ID Date Name 1 1/1/2009 a 2 1/2/2009 b 3 1/3/2009 c I need to get result something like... 1 1/1/2009 a 2 1/2/2009 b 3 1/3/2009 c 4 1/4/2009 Null 5 1/5/2009 Null 6 1/6/2009 Null 7 1/7/2009 Null 8 1/...

SQL WITH Statement, Unknown Column in where clause

Hi all, I ve got the following query which is throwing the following error Unkown Column 'RowNum' WITH Employees AS ( SELECT (keyTblSp.RANK * 3) AS [Rank], sp.*, addr.Street, addr.PostOfficeBox, addr.StreetNumber FROM Employee sp INNER JOIN FREETEXTTABLE(Employee, *, 'something', 1000) AS keyTbl...

MS Sql sever 2005 installation error

When trying to install sql server 2005 on Windows 2003 server ,i am getting the error 'Failed to load SqlCu.dll' I've tried searching elsewhere but not found and solutions to the error. Any ideas much appreciated! ...

SQL Server 2005 create assembly from stream with C#

Hello, Can i create an assembly from a stream much like MSSMS generated assembly script? I need to create an assembly from a DLL that is placed in a directory the SQL Server doesn't have access to. The assembly installer does have access to the assembly though. So my question is: can i read the assembly and generate a create from the str...

Migrating data from SQL Server to mysql using inserts

I am trying to migrate data from SQL Server to mysql, and i'd like to do that using insert-statements, so i modified this nice script by Narayana Vyas Kondreddi to generate mysql-friendly code and everything works fine so far. the problem being columns of the TEXT datatype that can be more than 8000 characters long (containing long blo...

Pivot sql query

I've SQL Server 2005 table COMPETITOR (Id, Title, cDate, Price) I want to format the query so that its view in Gridview will be like this: Please help me writing the sql query. ...

Looking for an efficient way to pass a collection parameter to a SQL Stored Procedure

Hi, I need to pass a collection of objects as a parameter to a stored procedure. Initially, I thought of serializing this collection and passing it to the procedure as a xml string. Then, inside the procedure, I'd use XML to get the data from the string parameter and use it. But I thought this approach was not performatic at all. I wa...

SQL Server 2005 select for XML path with union in sub-selection problem

Hi There, I'm rather experienced with SQL server "select for XML path" queries but now i run into a strange problem. The following query works fine: select ( select 'Keyfield1' as "@Name", t1.Keyfield1 as "Value" from MyTable t1 where t1.KeyField1= t2.KeyField1 and t1.KeyField2= t2.KeyField2 for xml...

Lookup Data in SQ1L 2005

Hi Friends, I need to provide lookup data for tables but I dont know what is it. Can some body please let me know how can I get it. I would really appreciate your help. Thanks, ...

SQL Server 2005 - Good SQL to create a data dictionary

I have to create a data dictionary in an existing database for all user tables within that database in SQL Server 2005. Does anyone have a good piece of sql to use for this purpose. I am intending to add comments in myself after I have the details of the tables and columns. ...

Random selection while breaking down by percentage over multiple groups

I'm trying to put together a simple system for a user to generate a list of users to whom surveys will be sent. The list generation may depend on various constraints. For example, "we only want people from the U.S. and Canada" or "we only want people who have a level 2 or level 3 membership." This part is pretty easy and I've set up the...

Any suggestions for identifying what indexes need to be created?

I'm in a situation where I have to improve the performance of about 75 stored procedures (created by someone else) used for reporting. The first part of my solution was creating about 6 denormalized tables that will be used for the bulk of the reporting. Now that I've created the tables I have the somewhat daunting task of determining ...

SQL Server 2005 Jobs Issue with Multiple Steps

Hi there I have a SQL job that containing multiple steps with queries below. Each steps has the same stored procedure but different parameter and file output obviously. What I found is that it is only attaching the output file for the LAST step. All previous steps are without attachment. If I do this on seperate invidual job, all jb wor...