sql-server

Where does Reporting Services store its log files

The most relevant google result seems to indicate that in order to access the logs we have to depoly our own log tables to the database and make Reporting Services write to it. Simply put: surely there must be plain text log files for Reporting Services? If yes, where are these files stored? ...

How do you fix queries that only run slow until they're cached.

I have some queries that are causing timeouts in our live environment. (>30 seconds) If I run profiler and grab the exact SQL being run and run it from Management Studio then they take a long time to run the first time and then drop to a few hundred miliseconds each run after that. This is obviously SQL caching the data and getting it ...

DB Connections in ASP.NET, MySQL vs. SQL Server

I'm using MySQL in an ASP.NET project I'm currently working on, I did some tests to test the performance of the MySQL .NET provider but unfortunately I'm not very pleased with the results. A very simple loop that only opens the connection was 10x faster in SQL Server: // MySQL const string CONNECTION_STRING = "server=localhost;databa...

Nested Repeaters and SqlDataSource Parameters.

I am using nested repeaters to build a table for reasons I won't discuss here, but what I'm looking to do is have two datasources, one for the top level repeater that will correspond to the rows, and one for the second level repeater that will return cells within a row. What I'm wondering, however, is if I can somehow specify a paramete...

How Many Tables Should be Placed on the Same Partition Scheme?

My company just provided me with SQL Server 2005 Enterprise Edition and I wanted to partition some tables with large(r) amounts of data. I have about about 5 or 6 tables which would be a good fit to partition by datetime. There will be some queries that need 2 of these tables in the course of the same query. I was wondering if I should...

Best way to create a default Database setup via an .aspx page?

We are going to be selling a service that will be hosted by us, and each client we host will have their own database, but there will be one centralized website. I currently have a blank database with the few things that a new client will need. What is the best way to copy this database so I can setup another client? I want to be able ...

Does the 'Enable Advanced Performance' override FILE_FLAG_WRITETHROUGH on Win 2k3/SQL Server 2005

SQL Server opens files with FILE_FLAG_WRITETHROUGH, which appears to force writes to the physical disk. In SQL Server-speak this is called 'Forced Unit Access (FUA)'; a white paper discussing this can be found here. Many SANs appear to honour this and this might explain slow performance of an ETL process I am developing on a server con...

How to locate Rows in SQL Table where xPath

Imagine the following table: ------------------------------------------------------------- ID | XML ------------------------------------------------------------- 1 | <Form><object ID="1" /></Form> 2 | <Form><object ID="2" /></Form> 3 | <Form><object ID="2" /></Form> ---------------------------------------------...

SQL Server 2008 Backup Compression Standard Edition

I'm trying to backup a database in SQL Server 2008 and have the database compressed using the new compression feature. However, when I run the following code, I get a weird error message: Backup Database <Database> To Disk 'C:\Backup' With Compression I get this error message: Backup Database With Compression is not supported on S...

Can I set "Parameters per stored procedure" higher than 2100 in SQL Server 2005/08?

There is a hard limit of the number of parameters any single SQL statement can have, and that is 2100 (for SQL Server 2005), or 1024 (for SQL Server 2000). Does anyone know of a way to increase that number? If you'd like to know "why" (as I would be dying of curiosity myself), the ansewr is in this: MyL2SDataContext.Accounts.Where(acc...

Microsoft Sync Services - good solution for me?

We upload sales transactions from our stores to the headoffice server. At the moment, we use DTS (SQL Server Data Transformation Services), but we’re planning on replacing that with Microsoft Sync services for ADO.NET, as this seems to be Microsoft’s preferred solution for this type of setup and we want to follow the standard (that will ...

Generating sequences for subsets of a table

I have a table in SqlServer 9 with data of the form Code Number J 0 J 5 J 8 Y 2 Y 8 I'd like to add a column that has a number with the internal sequence of numbers for each code, so that my table looks like this; Code Number Seq J 0 1 J 5 2 J 8 3 Y 2 ...

How can I concatenate a String with a Bit (documentTitle+Archive) SQL server 2005

I get the following error when I try to concatenate Operand type clash: text in incompatible with bit Invalid operator for datatype: Operator equals Add, Type equal bit SELECT F.SubmissionId, F.FormId, F.DocumentTitle + F.Archive AS DocumentTitle, F.Keywords, F.PublishDate, F.PostedDate, F.ExpiredDate, F.IsFlag, F.IsAdminOnly,...

Dynamically Changing what table to select from with SQL CASE statement

I'm trying to write a stored procedure and depending on a certain column value, I want to be able to change what table I select from. I'll try to give an example: SELECT ItemNumber, ItemType, Description FROM CASE ItemType WHEN 'A' THEN TableA ELSE TableB END WHERE CASE ItemType WHEN 'A' THEN ItemNumber = @itemNumber...

SQLServer SQL query with a row counter

I have a SQL query, that returns a set of rows: SELECT id, name FROM users where group = 2 I need to also include a column that has an incrementing integer value, so the first row needs to have a 1 in the counter column, the second a 2, the third a 3 etc The query shown here is just a simplified example, in reality the query could be...

.NET - Unit Testing Your Code and State in Your Database

Assumptions: We use .NET coding against SQL Server 2005 I was just wondering how most people incorporate state into the Unit Tests that affect their database? I know when and where to use mocking, but when you want to move past that and actually do some database tests... what strategies do you use to setup and teardown your database? Do...

SQL Server: Server-side blob cursor?

i'd like to read binary data from a blob, using the Stream interface around it. But i don't want the blob to have to be loaded entirely client side and stored in memory, or in a file. i want the code that uses the blob to be able to seek and read, and only as much data that is needed to support seek/read is brought over the wire. i.e...

How to PRINT a message from SQL CLR function?

Is there an equivalent of PRINT 'hello world' which can be called from CLR (C#) code? I'm trying to output some debug information in my function. I can't run the VS debugger because this is a remote server. Thanks! ...

Microsoft SQL Server 2008 error when restoring database

I've just recently upgraded to SQL Server 2008 from 2005 and when I attempt to restore a database I get the following error... "Could not load file or assembly 'Microsoft.SqlServer.Sqm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" ...

.NET - SQL Connection Error - Developing a Web App Locally

I have Visual Studio 2008 and SQL Server 2008 Developer Edition installed on a Windows XP machine. I get this error when trying to work on a Test Web Application: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instan...