sql-server-2005

Cannot delete SQLServer2005 data or log files

I was trying to restore a backup but I kept getting OS error 32 - cannot delete because in use. Couldn't figure out what was locking the data and log files - so I rebooted the machine, stopped the service but still no luck. Then I deleted the DB but data and log files are still there. Rebooted again - tried to delete them but looks li...

Is it possible to delete an SSIS package from the MSDB database in SQL Server 2005 without DCOM rights?

Unfortunately we do not have the required DCOM access to the SQL Server mentioned in this MSDN article but we do have full admin rights on the SQL Server instance. We can therefore successfully deploy a package to the server and run it using the SQL Server agent but I cant work out how to delete a package from the server. The only thin...

How can I delete an SSIS Package saved on SQL Server?

I have an SSIS package that I've saved under Maintenance Plans on SQL Server 2005. Though I can select SSIS packages, I am not sure how I can delete them. ...

problem of conditional visibility and page breaks with rectangles in SSRS 2005

I am trying to insert a conditional page break, actually i had a report of 50 pages with invoices each invoice is 3 pages long so i need a paghebreak for the 2nd invoice t printon the next page as i need the whole report ot print back to back,so i inserted one page break,so this starts the next invoice to start on 4th page but i want nex...

Can I ALTER a partitioned table in SQL Server 2005?

I'm looking into horizontal partitioning for a table that has time-series data in it. I've discovered that partitioning is much easier in 2005 than it was in 2000 but I can't seem to find this answer: Can I add/drop columns of a partitioned table? Are special steps required because it's partitioned? ...

How do I specify the width of a computed varchar column?

I want to create a persisted computed column in a table so that I can use it as part of a foreign-key relationship to another table. I have these tables: Events (EventID uniqueidentifier, EventCode varchar(8)) -- EventCode is a discriminator column Parties (EventID uniqueidentifier) ... and I want to add an EventCode column to "Part...

SQLServer 2005 and UTF8

I'm trying to setup a sqlserver 2005 that will be accessed using C++ and ODBC (the data read will be sent in XML files). So, I want to read data from the database (preferably utf-8), compose a XML file and send it. I have been browsing around and i haven't found a way to setup the database and the tables for using utf-8 (as in MySQL). I...

How to save data from a semicolon delimited file using Bulk Insert in SQL Server 2005 and BCP 9?

Here is my sample data: 1;a;b;c;; 2;d;e;f;; 3;g;h;i;; 4;j;k;l;; 5;m;n;o;; 6;p;q;r;; Here is my sample format file (BCP 9): 9.0 7 1 SQLCHAR 0 0 "" 0 x Latin1_General_CI_AS 2 SQLCHAR 0 0 ";" 2 i Latin1_General_CI_AS 3 SQLCHAR 0 0 ";" 3 s Latin1_General_CI_AS 4 SQLCHAR 0 0 ";" 4 t Latin1_General_CI_AS 5 SQLCHAR 0 0 ";" 5 u Latin1_Genera...

SQL Server - Enforcing uniqueness in one column depending on another column

Apologies if I get the terminology wrong. How do I define a constraint in MSSQL Server 2005 to enforce uniqueness in one column depending on another column? E.g. considering the last two columns: 1 A 1 2 A 2 3 A 2 <- Disallow because '2' has already appeared alongside 'A' 4 B 1 5 B 2 ...

Partitioning in SQL Server 2005

Hello folks, I have some questions about partitioning and strategy, how and when to use it. As I understood from Partitioned Tables and Indexes in SQL Server 2005, partitioning is not used only for manageability but also to improve performance on very large database tables (VLDB). We have a table with millions of records. This table st...

Stored Procedure Serialization Problem

Is the following stored procedure code robust for multi-user application. It is working fine. I was wondering if there is any better way to do it and if there is any performance issues. The proc has three sql statements together like 1.Updating hardware status in Allocation Table 2. Calculating Next appropriate Primary Key value for new...

Are Transactions allowed by default in SQLServer?

I need to use DbTransactions (on a single db) but I am not sure about how to make sure it will keep working when I deploy to the production environment. What are the requirements for an application to be able to use SQL DbTransactions? Are they allowed by default in SQLServer (and what's the deal with MSDTC)? ...

SQL order by and left outer join doesn't have correct order

I have a view that is joining two tables and ordering by the first table. Except that the order isn't correct. It misses an occasional record, and then at the end, most of those records exist in order, and then at that end, the rest of the records exist in order. So it has records such as 1 (most of the records in order) 2 4 5 6 7 ...

How do I remove offline Files from a SQL Server 2005 database

I have a database that was restored from a SQL 2000 instance to a SQL 2005 instance some time ago. The SQL 2000 instance had old, unused Full Text Searches defined. It appears that, when the file was restored, the full text searches were not restored but just deleted. This left the database in a funny state, with the FTS files still as...

What bcp format file that I'm gonna used to insert 59 columns?

First Observation, limitation with this BCP format file Data File: (Continuous up to three lines) 1;a;b;c;d;e;f;; 2;d;e;f;g;h;i;; 3;g;h;i;j;k;l;; 4;j;k;l;m;n;o;; 5;m;n;o;p;q;r;; 6;p;q;r;s;t;u;;What bcp format file that I'm gonna used to insert 59 columns? Format File: 9.0 9 1 SQLCHAR 0 0 "" 0 x "" 2 SQLCHAR 0 0 ";" 2 col1 Latin...

How to programmatically find a many to many relation in an SQL Server 2005 database

I can find a direct table foreign key in c# like: foreach (ForeignKey key in CurrentTable.ForeignKeys) { Console.WriteLine("FK:" + key.ReferencedTable); } The classic representation for a many to many relationship is achieved via an intermediate table that has a one to many relation to the two principa...

How to switch between databases

Our application uses a large product database that is updated once a day. Updates require a lot of time and resources. Thats why we update a backup of the product database and switch to it once the updates finished. The only way to switch between databases right now is to misuse our loadbalancer. The application always uses the same ip ...

SQL Server Replication connection error

After I renamed my PC, I couldn't create new paublications, for database replication in SQL Server 2005. I receive un error "SQL Server replication requires the actual server name to make connection to the server." When I returned my old PC name, the problem solved. How could I make use of replication after renaming the PC? ...

Can you search SQL Server 2005 Stored Procedure content?

SQL Server Server 2005. I'm staring at a database that has 500+ stored procedures, and trying to glean the intricacies of how they interact with the data - particularly in regards to how they insert/modify data. I was hoping to find a search" or "find" functionality that would look at the content of the actual procedure. That way, I c...

Exporting data from a table to a SQL script

In SQL Server 2005, is there a way I can create a INSERT script from a table that has several rows? A lot of times, while developing, I need to drop the table and recreate it. I end up having to manually add the rows that existed before. I have used SELECT FOR XML AUTO before dropping the table but it still needs some manual intervention...