sql-server-2005

How to create a SQL Server replication using DB backup?

Hello, I am trying to build a DB replication using MSSQL 2005. Both publisher and subscriber are SQL Server database. I know I can create subsriber database from the snapshop of publisher. However, snapshot agent will put the share lock on publisher DB, which is a production database. Is there any way I can build a replication and i...

SQL Server 2005 - Setting a column as readonly

I have a "InsertTime" field in a table in a SQL Server 2005 database which is defaulted to "getDate()" when the record is first inserted into the database. I want to ensure that this column is not updated again. Can this column be set to readonly or is there a better way to do this without writing all of the sql for the developers? ...

Check whether a value is present in a column or not in sql server 2005

Hai guys, I have a table with a column named Is_Deleted and my query is select Is_Deleted from Stock where Stock.Mat_Id=1 Now i have to write a condition to check whether all values are 1 else i have to terminate my loop.. How it can be done? any suggestions... ...

How to get table and column names from existing sql server snapshot/backup file

Hi, We are designing a windows application where we need to 'Get table and column names from existing sql server snapshot file or backup file' . Does anybody know how it can be done. Please provide help. Thank you. ...

SQL Server 2005 deadlock with nonclustered index

Hello, Can anybody help me for a deadlock in SQL Server 2005? For a simple test, I have a table "Book" which has a primary key (id), and a column name. The default index of this primary key is nonclustered. The deadlock happens when two sessions run at a same time. Activity monitor shows the first session "//step 1" locks the row(rid...

SQL Server 2005 - Priority Queries

Is there any way to give a particular SQL login higher priority for running queries? We have one server, that has multiple databases, unfortunately one of the databases occasionally runs very intensive queries (which aren't too time dependant), and it slows down the rest of the databases on the server. I'd like to be able to tell the se...

Finding One record from table having unique PK and duplicate FK

I want one record from a table having unique Primary Key and duplicate Foreign Key Please see attached image below Thanks ...

join three tables in sql server 2005

Hai guys, I ve thus far used join with two tables but now i want to join three tables which is shown in the below fig I ve tried to join two tables, SELECT O.OrderID,O.CustID,O.OrderTotal,C.Name from Orders as O inner join Customers as C on O.CustID=C.CustID how to join the third table with this.... Any suggestion... ...

How to compare rows with out returning it in a query

I am trying to count the no of buses based on no of conditions. Problem is in a subquery it is returning 2 rows. I am expecting the count to be = 1 if all conditions are true. but it is giving it according to returned rows. Can u plz help how can i just compare rows instead of returning rows. ...

comparing the values of two columns in a table in two different database in sql server

i have 2 datbases A and B with tables AC and BD.table AC has a column ACcol and BD table has a column BDcol. i want to move all the records in ACcol to BDcol with ACcol='admin'. can anyone help me in doing this? ...

Sql Server Compact Edition version error.

I am working on .NET ClickOnce project that uses Sql Server 2005 Compact Edition to synchronize remote data through the use of a Merge replication. This application has been live for nearly a year now, and while we encounter occasional synchronization errors, things run quite smoothly for the most part. Yesterday a user reported an err...

Troubleshooting failover cluster problem in W2K8 / SQL05

I have an active/passive W2K8 (64) cluster pair, running SQL05 Standard. Shared storage is on a HP EVA SAN (FC). I recently expanded the filesystem on the active node for a database, adding a drive designation. The shared storage drives are designated as F:, I:, J:, L: and X:, with SQL filesystems on the first 4 and X: used for a back...

Question on how to read a SQL Execution plan

I have executed a query and included the Actual Execution Plan. There is one Hash Match that is of interest to me because it's subtree uses a Index Scan instead of an index seek. When I mouse over this Hash Match there is a section called "Probe Residual". I had assumed that this is whatever values I am joining on. Am I correct here ...

Attendance table in sql server 2005

Hai guys, My web application stores attendance of employees daily.. How to design an attendance table in sql server 2005? I tried to figure it like this, Attendance table will contain columns EmpId,MonthId,1,2,3,4.....31.. Is this ok enough to hold attendance? Any siggestions.... ...

set column value to part of a string in another column

hi, i have a table with a column named CustomerName which stores a customer's full name(thats both names of a customer - first name, last name and any other names). I want to redesign this table such that instead of just having CustomerName field, i should have CustomerFirstName, CustomerLastName and CustomerOtherNames(then customerName...

Prevent insertion of additional child rows

My application involves using submitting data (the "request") from a form into an SQL Server 2005 database, for later review and approval by a supervisor. Users should have permission to insert a new request, but not be able to modify the ones they have already submitted. With a single table, this is straightforward: grant them the INSE...

C# SqlDataReader Execution Statistics and Information

Hi, I am creating an automated DB Query Execution Queue, which essentially means I am creating a Queue of SQL Queries, that are executed one by one. Queries are executed using code similar to the following: using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString)...

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x03B98F74.

I have simple SSIS ActiveX Script task that is returning with the above error when executing: I've cut all the code down to just an empty function: function main end function And have ensured the EntryMethod property of the component is main Any suggestions? ...

Database Error, Vendor Code 17

I have a problem with creating an report in my Webservice with ASP. Lokally everything works fine, connecting to SqlServers or MySQL Servers is no problem at all. But now !'m trying to connect to a SqlServer 2005 and i get an error, somthing about a database vendor code 17 (it's a german version, so i won't directly post the whole error...

Union in SQL Server 2005

Hi guys, The following is my query Select vehicleID from trip where (StartingDate between ''+ convert(varchar(10), @StartDate,111) +'' and ''+ convert(varchar(10), @EndDate,111)+'') or (enddate between ''+ convert(varchar(10), @StartDate,111) +'' and ''+ convert(varchar(10), @EndDate,111)+'') or(StartingDate <= @StartDate and enddate...