sql-server

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?? ...

How to alter the boolean value in SQL Server select query?

Basically I want to alter the boolean value selecting from the table: e.g.: SELECT otherColumns, not ysnPending FROM table I need a column ysnPending = true if the value is false & false if the value is true. Is there any function available to alter the Boolean value or I should use IIf or CASE...? ...

What's wrong with my fulltext search query?

I'm have some trouble with the fulltext CONTAINS operator. Here's a quick script to show what I'm doing. Note that the WAITFOR line simply gives the fulltext index a moment to finish filling up. create table test1 ( id int constraint pk primary key, string nvarchar(100) not null ); insert into test1 values (1, 'dog') insert into test1 v...

MySql LINK to SQL Server

I have a host with php+mysql and i need to run a script here to register accounts to another host that has SQL Server and i also have php+mysql here also , but i need the accounts to be in SQL Server. how can i do this? ...

check constraint custom message

Hi. Is there a way to perform data validation using CHECK constraints in t-sql and to show somehow the data which did not pass the check constraint? ...

ELSE in CASE WHEN

How can I add ELSE clause to the following code? ROW_NUMBER() OVER (ORDER BY CASE WHEN @OrderByColumn='ViewCount' AND @OrderDirection=0 THEN docsT.ViewCount END ASC, CASE WHEN @OrderByColumn='AddedDate'AND @OrderDirection=0 THEN docsT.AddedDate END ASC, CASE WHEN @OrderByColumn='AddedBy'AND @OrderDirection=0 THEN docsT...

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 query to get earliest date

if i have a table with columns id, name, score, date and i wanted to run a sql query to get the record where id = 2 with the earliest date in the data set. can you do this within the query or do you need to loop after the fact ? EDIT: To be explicit, I want to get all of the fields of that record . . ...

SQL Server to MS Access linked server: "Could not find installable ISAM."

Hi, I am trying to set up a linked server in SQL Server 2008 to a MS Access 2003 database that is protected by both a workgroup username and password, as well as a database password. It also uses its own system database (system.mdw) I used the SQL Server template, which is pretty much identical to the procedure I find by Googling and o...

Explain locking behavior in SQL Server

Why is that, with default settings on Sql Server (so transaction isolation level = read committed), that this test: CREATE TABLE test2 ( ID bigint, name varchar(20) ) then run this in one SSMS tab: begin transaction SH insert into test2(ID,name) values(1,'11') waitfor delay '00:00:30' commit transaction SH and this one simultaneou...

Database insert performance.

We are planning to implement a system for logging a high frequency of market ticks into a DB for further analysis. To simply get a little what kind of storage performance we can get on the different DB solutions I created a little application for inserting a basic row of tick information. When running the same code on a couple of differe...

SQL Server 2000 - Breaking out of a loop

Hello, I am not good at SQL Server 2000. I have a comma-delimited list of ids. I need to see if that ID exists in a table. If it does, I want to break out of the loop with that ID saved in a variable that I can use in my stored procedure. This is what I am trying right now: DECLARE @coreID INT SET @coreID=NULL DECLARE @itemID NVARCHAR...

Inserting one lakh rows at a time .. error identity column violation

I'm trying to insert row by row in a table about 100k records.. I get this error after some 140 or so.. Violation of PRIMARY KEY constraint 'PK_table1'. Cannot insert duplicate key in object 'table1'. The statement has been terminated. In this case the primary key is an IDENTITY column. I do not include that column in my IN...

JDBC SQL Server Database Migrations

I'm working on a Java web application (Adobe Flex front-end, JPA/Hibernate/BlazeDS/Spring MVC backend) and will soon reach the point where I can no longer wipe the database and regenerate it. What's the best approach for handling changes to the DB schema? The production and test databases are SQL Server 2005, dev's use MySQL, and unit t...

Sensible Way to Pass Web Data in XML to a SQL Server Database

After exploring several different ways to pass web data to a database for update purposes, I'm wondering if XML might be a good strategy. The database is currently SQL 2000. In a few months it will move to SQL 2005 and I will be able to change things if needed, but I need a SQL 2000 solution now. First of all, the database in question u...

Problem exporting SQL Server management Studio Express to Go Daddy

I'm having a terrible time exporting SQL Server Management Studio Express tables to the Go Daddy webserver. Go Daddy support can't help either. I started by using Microsoft Database Publishing Wizard for SQL Server thinking it would be 'easy'....not! I ran into user/password errors even though I was using the user and password that wa...

Migrating shape sql to something equally powerful

Hi, we are currently investigating a migration of an application that doesn't meet company standards. The application is built using VB6 and Shape SQL/Access. The application has about 120 reports by storing Shape SQL strings in a database which the user can modify using a wizard. Shape sql is not allowed at this company. We have invest...

Can we convert all SQL scripts to Linq-to-SQL expressions or there is any limitation?

I want to convert all of my db stored procedures to linq to sql expressions, is there any limitation for this work? you must notice that there is some complicated queries in my db. ...

How to select true/false based on column value?

I have a table with the following columns: EntityId, EntityName, EntityProfile, ................. I want to select the Id and Name and true/false column based on the value of entity profile, for example a returned result set like below, would mean that entities 1&2 have profiles while 3 not. 1 Name1 True 2 Name2 True 3 Name3 False etc....

How to resolve concurrent transaction issues in sales database

My application is storing some data in SQL Table called Transactions. Users are able to sell something from Client1 to Client2 and then Client2 has it. I am storing it in a table the following way: Client 1 | Buy | Something | Price | External | Client 1 | Sell | Something | Price2 | Client 2 | Client 2 | Buy | Something | Price2 | C...