sql-server-2005

Alter table add multiple columns ms sql

Is anyone can tell me where is mistake in this query ALTER TABLE Countries ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasText bit); ALTER TABLE Regions ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit HasText bit); ALTER TABLE Provi...

Creating an index with a where clause - SQL SVR 2005

I have recently discovered the ability to use WHERE clauses within indexes in SQL Server 2005. I would like to optimize some queries, and was hoping to get some feedback. The table of interest contains 2 float columns, [long] and [short]. These columns could be 0 in 20-40% of rows. There are several stored procs that query this table...

Replication in workgroup

I have configured transactional replication with Publisher and distributor which are on same and subscriber on different servers. Publisher and Distributor are running on MSSQL 2008 and the subscriber is running on MSSQL 2008. The both PC are running in the same workgroup. When I go to view synchronization status on Publisher, i am gett...

Evaluation of CTEs in SQL Server 2005

I have a question about how MS SQL evaluates functions inside CTEs. A couple of searches didn't turn up any results related to this issue, but I apologize if this is common knowledge and I'm just behind the curve. It wouldn't be the first time :-) This query is a simplified (and obviously less dynamic) version of what I'm actually doing...

Assign table values to multiple variables using a single SELECT statement and CASE?

I'm trying to assign values contained in a lookup table to multiple variables by using a single SELECT having multiple CASE statements. The table is a lookup table with two columns like so: [GreekAlphabetastic] SystemID Descriptor -------- ---------- 1 Alpha 2 Beta 3 Epsilon This is my s...

SQL server partitioning

I have a table that has millions of records and we are looking at implementing table partitioning. Looking at it we have a foreign key "GroupID" that we would like to partition on. Is this possible? The Group will have more entries added to it, so as new GroupID's are added can the partition's be made dynamically? ...

Custom StopWord List In SQL Server 2005 Full-Text-Search

Is there anyway to add some custom stop words to SQL Server 2005? ...

Connecting to SQL Server 2005 using classic ASP

I have installed both IIS and SQL Server 2005 on my laptop. Both work individualy, however when I try to connect to an DB from an ASP page I keep getting the following error: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "DB1" requested by the lo...

With SQL can you use a sub-query in a WHERE LIKE clause?

I'm not even sure how to even phrase this as it sounds weird conceptually, but I'll give it a try. Basically I'm looking for a way to create a query that is essentially a WHERE IN LIKE SELECT statement. As an example, if I wanted to find all user records with a hotmail.com email address, I could do something like: SELECT UserEmail FR...

SQL Server Query solution cum Suggestion Required

Hello All... I have a following scenario in my SQL Server 2005 database. zipcodes table has following fields and value (just a sample): zipcode latitude longitude ------- -------- --------- 65201 123.456 456.789 65203 126.546 444.444 and place table has following fields and value : id name zip ...

sql server 2005 stored procedure unexpected behaviour

i have written a simple stored procedure (run as job) that checks user subscribe keyword alerts. when article posted the stored procedure sends email to those users if the subscribed keyword matched with article title. One section of my stored procedure is: OPEN @getInputBuffer FETCH NEXT FROM @getInput...

How can I improve my select query for storing large versioned data sets?

At work, we build large multi-page web applications, consisting mostly of radio and check boxes. The primary purpose of each application is to gather data, but as users return to a page they have previously visited, we report back to them their previous responses. Worst-case scenario, we might have up to 900 distinct variables and around...

How to make a table Read Only in SQL Server?

Hi, i am updating some set of records in that table , after that i need to make this table read only. So How to make a table Read Only in SQL Server? Regards, Jeyavel N ...

transforming from 'Y' or 'N' to bit

Hello, I have a table which has a column called Direct of type char(1). It's values are either 'Y' or 'N' or NULL. I am creating a view and I want the value to be transformed to either 0 or 1 of type bit. Right now it's of type INT. How do I go about doing this? Following is the code: CASE WHEN Direct = 'Y' THEN (SELECT 1) WHEN...

Convert a SQL Server database to MYSQL database

Alright so I want to convert an already exist SQL Server database (2005) to a MYSQL database. There is nothing extraordinary to be done The only things I need to achieve is Recreate the tables Transfer data Relationships would be nice but not necessary No views, no sprocs, no functions. Any easy way to do this. Also do you know o...

SQL Server: how to optimize "like" queries?

I have a query that searches for clients using "like" with wildcard. For example: SELECT TOP (10) [t0].[CLIENTNUMBER], [t0].[FIRSTNAME], [t0].[LASTNAME], [t0].[MI], [t0].[MDOCNUMBER] FROM [dbo].[CLIENT] AS [t0] WHERE (LTRIM(RTRIM([t0].[DOCREVNO])) = '0') AND ([t0].[FIRSTNAME] LIKE '%John%')...

How to send reminder notifications to subscribers for renewal from SQL Server 2005?

I have a table in SQL DB, namely dbo.subscribers, it contains following columns: -SubscriberID -JoinDateTime The business logic says a subscription last for 2 weeks and a reminder should be sent after 7 days from the JoinDateTime. The way that the system was designed to send reminders are via a URL call, e.g. http://xxx.xxx.xxx.xxx/ren...

Committing Transaction

Hi http://msdn.microsoft.com/en-us/library/ms189797.aspx In this link they are committing a transaction within catch clause IF (XACT_STATE()) = 1, I don't get it, if there is an error why they are committing it? even if the problem in select statement and there is no big deal committing it, why don't just roll it back. Thanks ...

Sql server backup with password

Hello, world. When we backup data in SQL server, i want a way to password protect it. Is there a way to do this without using third party tools ? ...

unsetting application role in classic ASP

Hi, I'm trying to unset an application role but have been failing miserably. I was able to get the cookie value after setting (sp_setapprole) the application role. But I haven't been able to use that cookie (type varbinary / byte array) in my query to unset using sp_unsetapprole. If it was any other stored procedure it wouldn't have b...