sql-server-2005

SQL 2005 XML Schemas - Defining a Unique Attribute

Here's a Sample xml document I'm trying to create a schema for: '<Fields> <Field ID="-1">somevalue</Field> <Field ID="-2" /> <Field ID="-3" /> <Field ID="-4">Some other value</Field> <Field ID="-5" /> </Fields>' I'm trying to create a SQL Server 2005 schema collection to: 1. prevent dupicate id's. 2. only allow negative ids....

Unexpected table scan for id != id

One application causes a heavy load on our Sql Server 2005 database. We don't control the application that runs this query hundres of times a minute: select id,col1,col2,col3 from table where id != id Note the id != id, meaning a row is not equal to itself. Unsurprisingly, the result is always no rows found. However, Sql Server does a...

SQL Server 2005 Restore Hanging

I have a database showing up in SQL Enterprise Manager as "(Restoring...)" If i do SP_WHO there is no restore process. The disk and CPU activity on the server is very low I think it is not restoring at all. How can I get rid of this? I've tried renaming the underlying MDF file, but even when I do "NET STOP MSSQLSERVER" it tells me t...

ASP.NET Forms autosave

We have an internal asp.net forms app where one page is essentially a WYSIWYG editor that users enter 3-5 paragraph reports into. What are the best options for an autosave feature with the minimum amount of user-interrupt? I don't want to force a postback every five minutes or so unless I have to, but rather maybe some type of client-s...

Can I restore a database to a point of time without backup?

I have an SQL 2005 database with logging set to FULL but without any backups. Is it possible to restore it to a point of time? ...

Validate DateTime String in SQL Server 2005

Hi, I require a SQL script to validate a VARCHAR field in a table in a SQL Server 2005 database that contains DateTime values, in the format DD/MM/YYYY, or NULL values. I would like to identify all invalid dates. Can anyone suggest a method? UPDATE The answer has to make use of T-SQL; for performance reasons, I can't make use of SQ...

Update table using SSIS

I am trying to update a field in a table with data from another table, based on a common key. If it were in straight SQL, it would be something like: Update EHSIT set e.IDMSObjID = s.IDMSObjID from EHSIT e, EHSIDMS s where e.SITENUM = s.SITE_CODE However, the two tables are not in the same database, so I'm trying to use SSIS to do th...

Syncing SQL server 2000 with 2005 -- will DTS still work?

Hi, we have a local staging server running sql server 2000 and a remote public version also running sql server 2000. The remote version will be upgraded to 2005 and I am wondering if the DTS packages we have in place will continue to function between the two machines? If not, what would be the simplest, most efficient way to sync betwee...

synchronize two sql server 2005

I need to synchronize two sql server 2005 instances between intranet and extranet (through a firewall). Synchronization will be initiated from the intranet. What solutions do I have at my disposal? intranet db: table t1 -> extranet db: table t1 intranet db: table t2 <- extranet db: table t2 i.e. intranet t1 content should be pushed out...

Can't download adventure works database 2005 from codeplex

Can't download adventure works database 2005 from codeplex. Where else can I find and download it??? I've been searching it online, I found some results but i can't download any of them. Any help is appreciated ...

Using Group By Clause in Stored procedure

hi guys, I have a storedprocedure in which iam getting InvoiceValue as one field.I have different invoice values corresponding to 1 fileid.I want to get the sum of invoice values corresponding to each fileid.How can i use group by here? here is my stored procedure set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER Procedure [dbo]...

How to consume com libraries for SQLSERVERSMO ?

Hi I hav created a com library by which i can discover the SQLVolumes using SMo namespace in VS2005. Now i want to use this com library in VS2003 to discover the same sqlvolumes in another machine where vs2003 installed. Can i use like this. I hav created a COM using version VS2005 and now i want to consume it in VS2003 is it possible?...

Efficient way of uploading xls records to DB

Hi, What would be the most efficient way to upload records from an excel file to a table in the database. I am not allowed to use DTS/ SSIS. So I would like to know if there is a better alternative than reading records sequentially from the file and firing commands. Thanks. ...

Deleting hierarchical data in SQL table.

I have a table with hierarchical data. A column "ParentId" that holds the Id ("ID" - key column) of it's parent. When deleting a row, I want to delete all children (all levels of nesting). How to do it? Thanks ...

why would a SQLCLR proc run slower than the same code client side

I am writing a stored procedure that when completed will be used to scan staging tables for bogus data on a column by column basis. Step one in the exercise was just to scan the table --- which is what the code below does. The issue is that this code runs in 5:45 seconds --- however the same code run as a console app (changing the conn...

Execute package task produces The system cannot find the file specified error

I have an SSIS project that contains several SSIS packages. I have a master package that calls the other packages with execute package tasks that references file connections (one for each dtsx file). I am using file connections since this project is still in development and has not been deployed to a sql server. I can run the master pa...

Indexed view in Sql Server 2005 Error

I tried to add an index on a view in Sql Server 2005 an I got this error: "Cannot create index on view 'AllAssignmentNotes' because the view is not schema bound." I didn't want to put too much information here as it might be overload. Just wondering if anyone could give me some help. I went to the url the error gave me and got me nowhe...

SQL SELECT WHERE Trouble any ideas helpful

I have two tables parent and child (related as such on PK/FK GUID) Child has a Timestamp (the record creation date/time). What I want to do is get only the most recent child record AND the parent record, FOR EACH parent record. SELECT dbo_Parents.ParentName, dbo_ChildEntry.CountPropertys, dbo_ChildEntry.DateTimeStamp FR...

Specific Time Range Query in SQL Server

Hi All, I'm trying to query a specific range of time: i.e. 3/1/2009 - 3/31/2009 between 6AM-10PM each day Tues/Wed/Thurs only I've seen that you can get data for a particular range, but only for start to end and this is quite a bit more specific. I didn't see any SQL Server commands that would directly help me on this, so does an...

Inline documentation for SSIS packages

Hi, is there a way to create an inline documentation (like javadocs) for SSIS packages? Or what other techniques do you use to document the things you develop for SQL Server 2005? Cheers, Andreas ...