sql-server-2005

Can EXEC master..xp_cmdshell be used on a set of data?

I have a single windows shell command I'd like to run (via EXEC master..xp_cmdshell) once for each row in a table. I'm using information from various fields to build the command output. I'm relativity new to writing T-SQL programs (as opposed to individual queries) and can't quite get my head around the syntax for this, or if it's even...

How to detect filename dyanamically in SSIS?

Hi, I need to convert a flat file to DB using MS SSIS. I need a way to look into a particular folder to fetch the (only) flat file, filename is of the format "FileName-CCYYMMDD.txt". Please help me if there is way to add a file from the folder OR Get a file name of the format "Filename-CCYYMMDD.txt" where is CCYYMMDD is the current d...

How do I avoid this blocking situation in .NET 3.0 / WinForms / SQLServer 2005?

Application 1 - Opens a SqlConnection and a SqlTransaction against a SQLServer 2005 database Inserts a record into Table1 Does not commit or roll-back the SqlTransaction - intentially keeping this alive to demonstrate / describe the problem Application 2 - Opens SqlConnection and a SqlTransaction against a SqlServer 2005 database...

When will SQLServer 2005 fail to do insert / update AND ALSO WILL NOT "throw" an exception?

After running a insert or update query against a SQLServer 2005 database, under what scenario (if at all) can this happen - SQLServer 2005 does not perform or fails to perform the insert / update, AND ALSO DOES NOT "THROW" AN EXCEPTION? Consider that we are running the insert or update query via a SqlCommand object. Also consider that t...

Disabling or overriding the excel and pdf export function in Reporting Services

Is there a way to disable or override the excel and pdf export function in SQL Server Reporting Services. I want to my own custom excel export. ...

Windows installer 4.5 and Sql Server 2005?

I de-installed sql server 2005 express some time ago when I installed sql server 2008 express. Doing that install required windows installer 4.5. Now I discover a reason to have sql server 2005 express again. (to reconnect to the outlook Business Contact Manager which requres it to connect to the default MSSQL\MSSMLBIZ database) How...

How to change string data with a mass update?

I have a table (T1) in t-sql with a column (C1) that contains almost 30,000 rows of data. Each column contains values like MSA123, MSA245, MSA299, etc. I need to run an update script so the MSA part of the string changes to CMA. How can I do this? ...

The most elegant way to import flatfiles into SQL server 2005 without using SSIS

For some reasons, SSIS is not avalialble. I read about OPENROWSET, but I will have others problem from on the format file and path of file. How can I do it in a elegant way? ...

Missing drive when attaching database in SQL Management Studio 2005

I'm trying to attach an external mdf file to my SQLEXPRESS instance from within the SQL Management Studio 2005. However, I'm unable to see the drive that the database file resides in under the directory browser within the "Locate Database Files" prompt. Is there anything that is preventing the Management Studio or the SQL instance from ...

Deploying WCF Client assembly in SQL2005

I'm trying to get a WCF Client assembly deploy in SQL 2005. This means I need to create/register the dependencies for my WCF Client, which are: System.Runtime.Serialization System.Web System.ServiceModel With this script: CREATE ASSEMBLY System_Runtime_Serialization FROM 'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication...

When using the latest jdbc driver for SQL Server 2005/2008 how do prepared statements, views, and stored procedures compare regarding performance?

When using the latest Microsoft jdbc driver for SQL Server 2005/2008 how do prepared statements, views, and stored procedures compare regarding performance? If I have a plain old select statement with some dynamic where clauses will I see benefits from moving from straight SQL in a prepared statement to a view or even stored procedure?...

How to find where all of the space in a SQLServer database is being used

We have a SQL server database which, according to Microsoft SQL Server Management Studio has just 119Mb out of 6436Mb available. Yet the command: EXEC sp_msforeachtable 'sp_spaceused ''?''' reveals a total reserved space that is less than 2Gb How can we find out where the rest of the space is being used? ...

Best way to create a SQL Server rollback script?

I am working on some schema changes to an existing database. I backed up the database to get a dev copy, and have made my changes. I will be creating a single roll script to migrate the changes on the production machine in a single transaction. Is there a best practice for creating a rollback script encase a deployment issue arises? B...

Optimizing Importing of Data to SQL Server 2005 with C#

I have a table that has about 1/2 million records in it. Each month we get about 1/2 million more records to import. These are currently shoved into another table in the DB, but will eventually be loaded directly from a txt file. For each of these new records, I have to determine if we have that record already, and if we don't, then i...

SQL Server Enterprise Manager 2005 - stored procedures not showing up

When using SQL Server Management Studio from SQL Server 2005, I can connect to an instance of SQL Server 2000... but none of the stored procedures show up. Is there some trick to allow SQL Server Enterprise Manager 2005 to properly talk to SQL Server 2000 databases? ...

SQL Server "AFTER INSERT" trigger doesn't see the just-inserted row

Consider this trigger: ALTER TRIGGER myTrigger ON someTable AFTER INSERT AS BEGIN DELETE FROM someTable WHERE ISNUMERIC(someField) = 1 END I've got a table, someTable, and I'm trying to prevent people from inserting bad records. For the purpose of this question, a bad record has a field "someField" that is all numer...

Return value from SQL 2005 SP returns DBNULL - Where am I going wrong?

This is the SP... USE [EBDB] GO /****** Object: StoredProcedure [dbo].[delete_treatment_category] Script Date: 01/02/2009 15:18:12 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* RETURNS 0 FOR SUCESS 1 FOR NO DELETE AS HAS ITEMS 2 FOR DELETE ERROR */ ALTER PROCEDURE [dbo].[delete_treatment_category] ( ...

Query AD from sql server 2005

I am attempting to query AD via ldap from within SQL Server 2005 but get the following error: Msg 7321, Level 16, State 2, Line 1 An error occurred while preparing the query "SELECT NAME,MAIL FROM "LDAP:///CN=foo,CN=Users,DC=bar,DC=com"" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI". This is after execut...

Stop LINQ to SQL from executing select statements after insert

I'm using LINQ to SQL to update my database. I'm inserting a lot of records, and when I call SubmitChanges(), LINQ to SQL executes an insert and a select statement for each object. I don't really care to update my objects after they are inserted into the database. Do you know I can prevent LINQ to SQL from issuing the select statement...

SQL 2005 Query Help

I have table with 50 entries (users with such details like Name Surname Location etc) I want to create a query that give me users from row 1 to row 10. Then another query that give me users from 11 to 20 and so on. Is there any way how to do that? Thanks ...