sql-server-2005

How to reverse a string (SQL Server 2005, SET BASED)

E.g. Declare @str varchar2(20) Set @str = 'A Student' Select Reverse(@str) Output: tnedutS A Expected being: Student A The output(using Reverse) is as expected. But my requirement is the one described. Help needed with SET BASED. I am using SQL Server 2005 ...

Updating XML using attribute to identify value in SQL server

I have a XML structure in a XML column on a SQL Server table as follows: <Customizations> <Customization name="OtherValue"> <value>Test</value> </Customization> . . . . <Customization name="Year"> <value>2009</value> </Customization> </Customizations> and I'm looking to update the value of Customization with the element with ...

APplication performance issue : SqlServer & Oracle

Hi, We have a applicaiton in Silverlight,WCF, NHibernate. Currently it is supporting SQL Serve and Oracle database. As it's huge data, it is running ok on SQL Sevrer. But on Oracle it is running very slow. For one functionality it takes 5 Sec to execute on SQL Server and 30 Sec on Oracle. I am not able to figure out what will be issue...

Mass data store with SQL Server

We need management 10,000 GPS devices, each GPS device upload a GPS data every 30 seconds, these data need to store in the database (SQL Server 2005). Each GPS device daily data quantity is: 24 * 60 * 2 = 2,880 10 000 10,000 GPS devices daily data quantity is: 10000 * 2880 = 28,800,000 Each GPS data approximately 160Byte, the amoun...

Is there a way to prevent Triggers from being disabled?

I have a trigger on a table that should never be disabled. It performs certain checks and there have been occasions when other developers have disabled it to get around it. This is not good so I want to be able to turn off trigger disablement on this table alone. Is this possible? If not, any suggestions please. thanks. WORKAROUND:...

Choose a XML node in SQL Server based on max value of a child element

I am trying to select from SQL Server 2005 XML datatype some values based on the max data that is located in a child node. I have multiple rows with XML similar to the following stored in a field in SQL Server: <user> <name>Joe</name> <token> <id>ABC123</id> <endDate>2013-06-16 18:48:50.111</endDate> </...

SQL Server Password

Is there any way of retreaving a SQL Server Authenticatiion password. I am running Server 2005 with admin rights. ...

How can I improve the below query?

I have the following input. INPUT: TableA ID Sentences --- ---------- 1 I am a student 2 Have a nice time guys! What I need to do is to extract the words from the sentence(s) and insert each individual word in another table OUTPUT: SentenceID WordOccurance Word ---------- ------------ -----...

Why sometimes I get "Cursor not returned from Query" from a valid select statement

I have some valid select statements that when I send to MSSQL2005 sometimes return the error "Cursor not returned from Query". It happens with different queries that work fine 99% of the time, and the only thing they all have in common is the use of several joins and some group by. Pretty standard queries. How can I trace this and find...

Getting SqlServer2005 error: backup set holds a backup of a database other than the existing 'DbName' database

I am trying to upgrade from a server running SqlServer2005 (no service packs) to a server running SqlServer2005 service pack 3. I am trying to copy the databases from one to another by doing a backup on one, then a restore on the other. I am using ssms. When I try to restore a backup of, call it DbName, created on the first server,...

SQL Query to return both distinct and total logins from a login table in sql2005

Hey all, I have a table Logins { Id, AccessTime }, I'd like to write a query that returns 3 columns, Total Logins during a time period, Unique Logins for a time period, and the Id of the user. I know I could do this with two passes and a join, is there a better way to do it in a single pass? Thanks, ~Prescott Edit: After considering...

Does linq to sql make stored procedures in ms sql 2005?

Hi I am looking through my stored procedures on my server and I got alot of them. The thing is I only made like 10 of the 100 there. These stored procedures are not system ones(that has its own folder). They seem to be stored procedures for every table I have. Example of one USE [DB] GO /****** Object: StoredProcedure [dbo].[usp_S...

ROW_NUMBER Alternative for SQL Server 2000

RIGHT now I'm using ROW_NUMBER() in my procedure in SQL Server 2008 as follows: WITH cars as(SELECT carid,mileage,retailprice,imageurl,model,year, Zips.Distance AS Miles, Manufacturers.mfgName as Make, dealers.companyname as companyname, CASE @sortby WHEN 'D' THEN ROW_NUMBER() OVER (ORDER BY Manufacturers.mf...

Setting collation property in the connection string to SQL Server 2005

I have a ASP.Net web application with connection string for SQL Server 2005 in the web.config. Data Source=ABCSERVER;Network Library=DBMSSOCN;Initial Catalog=myDataBase; User ID=myUsername;Password=myPassword; I want to specify the collation property in the web.config for different languages like French like Data Source=ABCSE...

SSIS: Using a View for a Sql Server Package Configuration

I have set up a View as the source for a Sql Server Package Configuration that has the same name and columns as the default table. It works in design-time but the package fails to load the configurations claiming the view is an Invalid Object at run-time. This seems like it should work because the view appears in the drop-down in the ed...

Replace beginning words

I have the below tables. tblInput Id WordPosition Words -- ----------- ----- 1 1 Hi 1 2 How 1 3 are 1 4 you 2 1 Ok 2 2 This 2 3 is 2 4 me tblReplacement Id ReplacementWords --- ---------------- 1...

C# DateTime Class and Datetime in database

Hello . I have the following problem. I have an object with some DateTime properties , and a Table in database that I store all that objects , in Sql server I want to store the DateTime properties in some columns of DateTime Datatype, but the format of datetime in sql server is different from the DateTime class in c# and I got an sql ex...

Asynchronous sqlserver

how can i use Asynchronous queries in sqlserver 2005 & asp (not .net) ...

Track bounced back newsletter emails

Hi, I've built a newsletter system which tracks: Openings Link clicks Unsubscriptions However, I need to find a way of tracking which newsletter emails 'bounced back'. Has anyone done this before and whats the best way of doing it? Thanks, Curt ...

Is there any function in SQL Server to convert a number into Time format?

I am getting a whole number for the duration of product. For example : 62, 103, 184, 4543. I want to convert it in time format. Let say , in case of 62, it would format like '00:01:02'. I am looking for a function which can resolve my problem. Is there any function in SQL Server which convert a number into time format? ...