Tag: sql-server-2005

How to select data using multiple times in the 'where' clause

I have two columns of data in a SQL 2005 DB Datetime Value ‘2009-10-29 10:00:00’ ‘ 10.1’ ‘2009-10-29 10:15:00’ ‘ 10.2’ ‘2009-10-29 10:30:00’ ‘ 10.3’ ‘2009-10-29 10:45:00’ ‘ 10.4’ I want to SELECT Value FROM [table] WHERE Datetime >= ‘2009-10-29 10:00:00’ AND (Datetime NOT BETWEEN ‘2009-10-29 10:14:00’ AND ‘2009-10-29 10:16:00’ ) AND Datetime < ‘2009-10-29 […]

Compatibility of the upgrade of MSSQL 2000 to MSSQL 2005

Actually I have to find out the compatibility of the upgrade of MSSQL 2000 to MSSQL 2005. The MSSQL 2000 was installed inside the Citrix box . I did a side by side upgrade by backing up the database and restoring in my local machine. Now I have to figure out if the applications will […]

Query to show result in the charts

I have to implement charts in my application. Suppose i have a table structure DECLARE @SONGS TABLE ( [ID] INT IDENTITY, [SONGNAME] VARCHAR(20), [CREATEDDATE] DATETIME ) INSERT INTO @SONGS SELECT ‘SONG1′,’20091102’ UNION ALL SELECT ‘SONG2′,’20091103’ UNION ALL SELECT ‘SONG3′,’20091107’ UNION ALL SELECT ‘SONG4′,’20091107’ UNION ALL SELECT ‘SONG5′,’20091107’ UNION ALL SELECT ‘SONG6′,’20091109’ Now user will pass […]

Merge Select statement and order dynamically?

I have a select statement which will return me 5 values as val1,val3,val5,val2,val4 I have another select statement which is going to return a set of records with one of the column having values from the above set (val1 to val5) Is it possible to sort the second select statement with the result of the […]

Sql Server CE 3.5 Merge Replication Synchronise is Hanging

I am using SQL Server 2005 CE framework 3.5 and attempting to use merge replication between my hand held and my SQL Server. When I run the code to synchronise it just seems to sit forever, and when I put a breakpoint in my code it never gets past the call to Synchronize(). If I […]

SQL Server service broker reporting as off when I have written a query to turn it on

I have made a small ASP.NET website. It uses sqlcachedependency The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications. Description: An unhandled exception occurred during the execution of the […]

How to define a user-defined data type with addressable members?

I have an unusual situation to model in a MS SQL Server database: the primary key of a table is a multi-segment ‘natural’ key composed of 5 foreign keys (of fixed sizes). I’d like to be able to define a user-defined data type to implement the data structure based on a CHAR(8) primitive in such […]

How Do You Save An Image Out of a SQL Database Into the File System Using only SQL?

Similar to this question only the other way of flow. Insert Picture into SQL Server 2005 Image Field using only SQL I need to be able to save a image field out into the file system and be able to name the file with only using SQL. I don’t want to use TEXTCOPY either because […]

Private Key issue in Service Broker

We are trying to make conversation between two SQL instances in one SQL Engine through Service Broker by following tutorial from MSDN. In order to make it simple , we send the dialog with Encryption = OFF so we do not need to deal with Master key , Certificate… and it works in the local […]

Error creating indexed view

I have problem with a counting column in my view. SELECT ColumnC, ColumnA % ColumnB AS ModuloColAColB, COUNT_BIG(*) AS cBig FROM dbo.T1 GROUP BY ColumnC, ModuloColAColB Query is similar to this MSDN example: http://msdn.microsoft.com/en-us/library/ms191432.aspx When I try to compile view I received error message like: “invalid column name ModuloColAColB” So I change group by column […]

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