sql-server-2005

SQL Server - Timed Out Exception.

We are facing the SQL Timed out issue and I found that the Error event ID is either Event 5586 or 3355 (Unable to connect / Network Issue), also could see few other DB related error event ids (3351 & 3760 - Permission issues) reported at different times. what could be the reason? any help would be appreciated.. ...

C# Linq question: How to identify and count items in a set

I have a friend who is using c# Linq to report on the following table: varchar(50) name datetime when The customer wants to pick what columns to summarize, like Total for this year, Total for Last year, Total for two weeks ago, etc. Each column would have some begin and end time they summarize with a count. I did a quick select s...

Issue with SQL Stored procedure.

I could see the below entries in the ULS log 02/08/2010 14:36:46.12 w3wp.exe (0x15F4) 0x18A0 CMS Publishing 8x0a High AppDomainUnloadListener.RegisterSelf() entered lock(this=15368010) 02/08/2010 14:37:25.59 w3wp.exe (0x15F4) 0x1744 Win...

SQL Server Express 2005 set tcp listen port using command tool

Hello, I am making silent installation for SQL Server Express 2005 using the following command SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 SAPWD="****" ADDLOCAL=SQL_Engine,SQL_Data_Files,SQL_Replication,Client_Components,Connectivity,SDK I need to know is there a parameter or a command line utility to configure the service to listen t...

SQL Server primary key on datetime field

I'm creating a new table in SQL Server 2005 that needs 2 fields: DateTime and MyValue (Int32). The DateTime field will be unique so I will be setting a unique constraint on it. Which table structure is better and why? MyIndex (PK, int) MyDate (datetime) (IX_UniqueKey) MyValue (int) or MyDate (PK, datetime) MyValue (int) My feeling i...

Three phases of recovery : the analysis phase, the redo phase, and finally the undo phase.

SQL Server database recovery consists of three phases: the analysis phase, the redo phase, and finally the undo phase. Can anybody please explain clearly or give a good link on these three phases of recovery?? ...

Login Failed for user 'Q_User'.The user is not associated with a trusted SQL Server connection.

Login Failed for user 'Q_User'.The user is not associated with a trusted SQL Server connection. Where is the problem? ...

Need sql server 2000 for win 7 64 bit

I have SQL server 2000 dev edition. But it isn't compatible with my new win7 pro 64 bit computer. Is there a free version of 2000 that I can install on my 64 bit pc for development? As I understand it, I can restore a 2000 database to sql server 2008. But I wont be able to restore the database back to the 2000 server after making any ch...

SQL Server 2005

I want to use SQL Server 2005 as database.In know how to create table in SQL server 2005.But due to fault i reinstalled SQL Server 2005.After that i create table as follows start -> programs -> microsoft sql server 2005 -> sql server management studio express But in that "Sql server management studio express" not exit,How to display t...

Creating trigger in SQL Server 2005 (has to work in 2008 too) to prevent duplicates?

I have table that I insert data with following query (from c# code): INSERT INTO [BazaZarzadzanie].[dbo].[Wycena] ([KlienciPortfeleKontaID] ,[WycenaData] ,[WycenaTyp] ,[WycenaWartosc] ,[WycenaWaluta] ,[WycenaUzytkownik] ,[WycenaUzytkownikData]) VALUES (@varKlienciPortfeleKontaID ,@varWycenaData ,@varWycenaT...

Incorrect syntax near the keyword 'select' while execuing query

I am getting Incorrect syntax near the keyword 'select' after executing the following code. declare @c int SELECT @c = COUNT(*) FROM (select id, max(date_stored) from table B INNER JOIN table P ON B.id = P.id where id = 3) select @c I want to select total no of records having max stored dates in database. Can ...

Double of Total Problem

Table1 ID | WorkTime ----------------- 001 | 10:50:00 001 | 00:00:00 002 | .... WorkTime Datatype is *varchar(. SELECT ID, CONVERT(varchar(10), TotalSeconds1 / 3600) + ':' + RIGHT('00' + CONVERT(varchar(2), (TotalSeconds1 - TotalSeconds1 / 3600 * 3600) / 60), 2) + ':' + RIGHT('00' + CONVERT(varchar(2), TotalSeconds1 - (T...

SSIS development in SQL 2005 without BIDS

Is there any way to develop SSIS packages in SQL 2005 without using BIDS? ...

Backup failed after I truncated the transaction log

This morning I truncated my transaction before it's hourly backup. Since I truncated the transaction log, the backup failed. The error code I got was 0xC002F210. Any ideas why this happened? ...

Concurency issues with scheduling app

Our application needs a simple scheduling mechanism - we can schedule only one visit per room for the same time interval (but one visit can be using one or more rooms). Using SQL Server 2005, sample procedure could look like this: CREATE PROCEDURE CreateVisit @start datetime, @end datetime, @roomID int AS BEGIN DECLARE @isFreeRoom I...

Reference updated row for SQL Server trigger

I want to always update the value of an update row in the database. Imagine, i have a table with names and prices Every time a row is inserted or updated, i want to lower the price by a fixed amount. How can I do this with SQL server 2005? I have now something like CREATE TRIGGER LowerPriceOnInsert ON products AFTER INSERT, UPDATE AS...

SQL Server 2005 XML Query

Hi, I'm new to querying XML datatype in SQL Server 2005. Anyone can help me create a query for my requirement? Here's a scenario of my column. Column Name: Cabinet /*Row 1 XML Data*/ <shelf> <box> <item type="pencil" color="blue"/> <item type="pencil" color="red"/> <item type="paper" color="white"/> <item type="ribbon" co...

how to get an xml in a variable

I have a stored procedure that will return xml. I have delared a variable of type xml and trying to execute the following code declare @v xml set @v = execute get_xml @id, 33 whereas id is returned by another query. now it keeps compalinng about the following error Incorrect syntax near the keyword 'execute'. ...

how is xml stored in database

Hi , I have a table with one of the column being of type xml I enetered record as insert into table_1 values(1,'') i opened the mdf file in hex i found the "<>" missing. This is how it looks. 00000000: 30000800 01000000 02000001 002b00df †0............+.. 00000010: ff01b004 f0077000 72006f00 64007500 †......p.r.o.d.u. ...

Comparing 2 columns in the same table with the "Like" function

I'm trying to come up with a way to query the values in two different columns in the same table where the result set will indicate instances where the value of columnB doesn't contain the value of columnA. For example, my "Nodes" table contains columns "NodeName" and "DNS". The values should look similar to the following: NodeName D...