How can you configure or extend BITS (Background Intelligent Transfer Service) to read files from a Sql Server Database

I have a ASP .NET load balanced application (webservice and website). It runs on SQL server. I need to be able to provide large files for download. However, because of the load balancing situation, the files are stored in the SQL database as opposed to the file system. BITS seems to be the best approach. […]

How to get around UDF restriction on side-effecting operators?

Microsoft Books Online (BOL) on Using Change Data explains a misleading error messages for cdc.fn_cdc_get_all_changes_* & cdc.fn_cdc_get_net_changes_* when an invalid, out-of-range LSN (Log Sequence Number) has been passed to them. Msg 313, Level 16, State 3, Line 1 An insufficient number of arguments were supplied for the procedure or function `cdc.fn_cdc_get_all_changes_` … Msg 313, Level […]

SQL Server 2000 Script to list all Meta Data Services DTS packages

I am doing an SSIS package that would go out to all our DB servers to gather information about them, and what is on them. And in this one case there is a SQL 2000 box with a bunch of DTS packages on there. Now I can easily list the Local Packages using “exec sp_enum_dtspackages“, […]

Update SQL database with values from text boxes

Here’s what I have. User enters values into text boxes (personal information etc.) and then presses a save changes button. The values in these text boxes get stored in an SQL database. The problem I have is that when updating the database using the values from the text boxes, the page refreshes and the values […]

SQL Server 2005/2008 – Import a fixed width text file via the command line?

In MySQL I am able to create a table with fixed column widths and then can use the load data infile command to import a fixed width file. For example: Fixed width text file = JOHN 1234 Imports into table: Username – CHAR(8) Password – ChAR(4) The beauty of this approach is that the file […]

Stored Procedure: Variable passed from PHP alters second half of query string

Basically, we have an ASP website right now that I’m converting to PHP. We’re still using the MSSQL server for the DB — it’s not moving. In the ASP, now, there’s an include file with a giant sql query that’s being executed. This include sits on a lot of pages and this is a simple […]

SQL Server 2005 Index Fragmentation

Several keys in a SQL Server 2005 database I inherited have very high fragmentation percentages. When using the following SQL: select OBJECT_NAME(object_id), avg_fragmentation_in_percent, record_count, * from sys.dm_db_index_physical_stats (DB_ID(N’FragmentedDB’), NULL, NULL, NULL, ‘Detailed’) s I see that several tables with fragmentation % between 50 and 99. These tables all have over 100,000 rows, some with 2,000,000+. […]

SQL Server timestamp column not supported in Mono?

I am trying to run a .NET command line application in Linux using Mono. It accesses SQL Server 2005 Express database and, when querying some data it throws the following exception: System.NotSupportedException: Unknown Type : timestamp at Mono.Data.Tds.TdsMetaParameter.GetMetaType () [0x00000] at Mono.Data.Tds.Protocol.Tds70.WriteParameterInfo (Mono.Data.Tds.TdsMetaParameter param) [0x00000] at Mono.Data.Tds.Protocol.Tds70.ExecRPC (System.String rpcName, Mono.Data.Tds.TdsMetaParameterCollection parameters, Int32 timeout, Boolean wantResults) […]

String Encoding Issue

I am having a very weird issue in the way strings get stored in my database, and as a result, I am getting these “unterminated string literal” errors in Javascript. Here’s an overview of what I am doing: Platform: C#/ASP.NET MVC 1.0, SQL Server 2005, SparkViewEngine, YUI 2 In my view, I serialize an object […]

Display part of entry

Suppose a query “select streetAdr from Address” returns “236 a1 road” “333 a2 road” and 444 a4 road” as 3 rows. How i can display only “236” “333” and “444” in SQL Server.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.