sql-server-2005

Selecting between two dates within a DateTime field - SQL Server

How to select records between a date to another date given a DateTime field in a table.... ...

Any benefits to SQL Management Studio 2008 when only connecting to SQL Server 2005 databases?

We run SQL Server 2005 exclusively for databases that we use (I'm trying to push to get them upgraded, but alas!). On the client side with Management Studio, are there any benefits to upgrading to SSMS2008 when only connecting to SQL Server 2005 databases? I've seen that Intellisense won't work, so I'm curious if it's worth the hassle. ...

Blank screen when looking at Activity Monitor details

I'm looking at the Activity Monitor in SQL Server 2005 and when I double click a specific process to view the SQL I am given a blank screen. What does this mean? What could be causing this? ...

How to programmatically start SQL Server 2005 merge replication

We currently have merge replication set up to merge certain tables between two databases. I need to programmatically start one of the publications to make sure data has been synchronized prior to starting a certain job. SQL Server Books Online has not been too helpful. So far, the only thing I have come up with is to use sp_start_job ...

Activity Monitor Problems in SQL Server 2005

I am looking at the Activty Monitor for SQL Server 2005 and we have some processes that are taking up large amounts of the CPU. When I look at what is trying to be run I get: set transaction isolation level read committed This code is not coming from any of our applications. What is causing it? What should be done? ...

datetime in where clause

how can i select 12/20/2008 in where clause of sql. it is sql server 2005. select * from tblErrorLog where errorDate = '12/20/2008' ...

64 bit ODBC Exception

I am getting the following ODBC exception when I moved my development platform from Windows XP X86 to Windows 7 X64: ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application What I'm sure it means is that the server it is connecting to is 32 bit, and the comp...

How to get SQL query to not escape HTML data returned in query

I have the following SQL query.... select AanID as '@name', '<![CDATA[' + Answer + ']]>' from AuditAnswers for XML PATH('str'), ROOT('root') which works wonderfully but the column 'Answer' can sometimes have HTML markup in it. The query automatically escapes this HTML from the 'Answer' column in the generated XML. I don't want that....

Query to retrieve Text data type column value based on MAX value in other column

Hi I have a table with following columns and data FldID | Rev | Words 10257       2        Some text is present here 10257        3        I changed this text 10258        2        Some more text for another item 10258        3   ...

Views or table functions or something else.

I designed 5 stored procedures which almost use same join condition but parameters or values in where clause change for each on different runs. Is it best solution to create a view with all join conditions without where clause and then query from view or work on view? Can views auto update itself if i create view? Can i do sub-queries o...

Can I kill this process?

Possible Duplicate: Activity Monitor Problems in SQL Server 2005 I have some processes running on my database server that are taking up enourmous amount of CPU. When I view the detail about the process I get: set transaction isolation level read committed The other details include: Status: Sleeping Open Transactions: 0 Com...

What is the point of "Initial Catalog" in a SQL Server connection string?

Every SQL Server connection string I ever see looks something like this: Data Source=MyLocalSqlServerInstance;Initial Catalog=My Nifty Database; Integrated Security=SSPI; Do I need the Initial Catalog setting? (Apparently not, since the app I'm working on appears to work without it.) Well, then, what's it for? ...

Recommended way of SQL 2005 DB setup

Just got a win 2003 (64-bit) server box with 6 x 320 GB disks and intending to install mssql 2005 (64-bit standard). Thinking of setting up the following: Disk 1 & 2 run Raid 1, split into C:\ for OS (~50GB) and D:\ for all .ldf files (~250GB) Disk 3 to 6 run Raid 0, split into E:\ for .mdf files (~700GB) and F:\ for running backups et...

How to get column which has least values among them

CREATE TABLE exmp_test ( id int, v1 int, v2 int, v3 int, v4 int ) SELECT * FROM exmp_test id v1 v2 v3 v4 1 2 4 6 7 1 4 77 3 8 I want to add the value of the [id] column to (whichever has least value for v1 ,v2 ,v3 ,v4) for each row. As an example, for the first row, the [id] value should be add to v1 (because it ...

Relationships and constraints across databases

HI There, what are the possible ways in which i can maintain relationships across instances of databases . i know relationships across DB's is bad approach , but i have to do this way. i am using SQL SERVER 2005. Thanks DEE ...

Does Sql Server 2005 Require Sync Framework Install?

What I have found on the 'net seems a little ambiguous whether or not something needs to be installed on the server to use the Sync Framework with SQL Server 2005. My interpretation is no, that the ADO.NET'ness of the product reaches out to the server (assuming appropriately trackable tables exist). My goal is to use SQL Compact on the...

Best Practice for Application Tier Database Transactions

I have seen a number of different cftransaction examples and read different sites and still have not been able to find a definitive answer to what parts of cftransaction are necessary. What I am trying to accomplish is very simple: start a transaction run multiple inserts/updates close the transaction If there is an error at any time...

Help needed in AdventureWorks in a sql query.

I was just playing with adventureworks database in sqlserver. I got stuck in a query. I wanted to Select all titles from HumanResources.Employee which are either 'Male' or 'Female' but not both. i.e if title Accountant is Male and Female both I want to leave that title. I need only those titles where Gender is either Male or Female. I h...

SQL query to return only 1 record per group ID

I'm looking for a way to handle the following scenario. I have a database table that I need to return only one record for each "group id" that is contained within the table, furthermore the record that is selected within each group should be the oldest person in the household. ID Group ID Name Age 1 134 John B...

Merging records

Hello friends. I am working on a project in ASP.Net, and I am using SQL Server 2005. My problem is something like that: I have two Tables. Table A : Which has fields ID and Category (ID is primary Key) Table B : Which has fields ID, CategoryID, Item There is a relation A:ID ----> B.CaregoryID Lets Add some records. Table A: ID    ...