I Joined two tables , each one containing more than 5000 records . I used two methods to join . In the first query I used JOIN keyword and gave the condition in ON condition .
In the second query I just used a comma operator between the tables and gave the joining condition in WHERE clause .
Which one will be effective regarding time a...
I'm using Subsonic 2, SQL Server 2005.
Here is how I update intro_accepted column of a Member table record.
member.Showintro = true;
member.IntroAcceptby = AdminUser.Username;
member.IntroAccepted = DateTime.Now; // but I wan't getdate() from SQL Server
member.Save();
What is the easiest way to select getdate() from database and put ...
Hi everyone,
As an exercise (read:interview question) in index optimisation, I need a query which is slow on the standard AdventureWorks database in SQL2005. All the queries I've tried take about 1 second and I would prefer to have a query which takes multiple seconds so that it can be optimised effectively.
Can anyone here create such...
Is it possible copy the physical Transaction log file for SQL 2005?
Currently our databases are backed up every night with hourly Transaction logs taken during the day. Is it possible that after the hourly backup has been done that the physical log file can be copied to another server? what steps would need to be taken to get this to...
I have a DateTime field in SQL Server for some products expiration (ExpirationDate). I need to increment all the items manually, and set their expiration a month later than the date stored in the field currently. How can I do that?
...
How can I correct the following so that I don't receive a syntax error in Microsoft SQL Server 2005?
UPDATE Emp E
SET UserName = Left(FirstName,1)+LastName
WHERE EmpID=1
AND NOT EXISTS(
SELECT * FROM Emp
WHERE UserName=Left(E.FirstName,1)+E.LastName
)
...
I have an Entity-Value set of tables, and would like to pivot the results.
Here's the effect that I'm looking for, except you see that the SELECT stmt using Common Table Expressions isn't working exactly right yet.
My question is: Am I on the right track, or is there some sort of easy pivot command?
USE TempDB
Declare @Person TABLE(
Per...
Due to some restrictions, we have to run the service as LocalSystem. I have generated a certificate and placed them in the following stores:
Certificates (Local Computer)
Certificates - Service (SQL Server (MSSQLSERVER))
Certificates - Service (SQL Server (MSSQLSERVER))
Certificates - Current User
I am a domain admin. Everytime I go ...
what are some of the cases that will cause a SQL Server 2005 cursor to deallocate prematurely?
...
I have an application that is ready to go live, once we take data from a MS Access DB and import it into SQL Server 2005. I have used the Migration - Access tool to get the Access db into SQL Server, but now I need to take the data from that table and put it into the tables that our app is going to use. Is there a T-Sql way to Insert m...
Let's say I have a stored procedure in Microsoft SQL Server 2005 that returns a list of values (1 column result set). I want those list of values appear in Infopath (i.e. they are the values of say a dropdown list). How would I do that?
Let's say that I would also use other stored procedures for other dropdown lists.
Let's say I can a...
Hello Everyone,
This is my first question on StackOverflow, so please be nice ;)
Let's say I've got a trigger like this:
CREATE TRIGGER trigger1
ON [dbo].[table1]
AFTER UPDATE
AS
BEGIN
--declare some vars
DECLARE @Col1 SMALLINT
DECLARE @Col1 TINYINT
--declare cursor
DECLARE Cursor1 CURSOR FOR
...
HI,
I have an insert statement in a Stored Procedure that requires the value data to be a combination of text and variables/inputs. However my SQL Manager is giving an error on this 'camp' value when trying to compile it.
Here is the statement as it currently exists;
BEGIN TRAN
INSERT INTO TBL_DONATIONS ([donations_MemberID], [d...
We ported a database server from SQLServer 2005 to SQLServer 2008 (SP1). The new server has more Processors (4 Quadcore versus 1 Quadcore ) and more memory (4GB versus 64GB).
Processors are 2.1Ghz(new) versus 2.0Ghz(old).
The new OS is Windows Server 2008 and the old is Windows Server 2003.
The databases were transfered via backup/rest...
I have a Sales tax column in one of my SQL Table where Data is stored.
I was wondering is it possible to place an constraint on the table itself for the Sales Tax
Column saying " if > June 2008 tax is 2 % " else "tax is 4 %"?
Should that come from stored procs related to that Table?
...
'DateM (Monday): ' + ISNULL(@Mon,'')+CHAR(13)+CHAR(10)
'DateT (Tuesday): ' + ISNULL(@Tues,'')+CHAR(13)+CHAR(10)
RESULTS:
Is not wrapping.
DateM (Monday): Sep 8 2009 12:00AM DateT(Tuesday): Sep 9 2009 12:00AM
I want it to wrap.
DateM (Monday): Sep 8 2009 12:00AM
DateT(Tuesday): Sep 9 2009 12:00AM
...
I have a Rate column in one of my SQL Table where Data is stored.
The data in the rate column , is coming thro an Stored proc.
In that existing stored proc, I found the condition
BEGIN
IF @taxPrd < '07/01/2000' OR
@taxPrd >= '11/01/2001' AND @taxPrd < '04/01/2003'
BEGIN
I changed it to ...
My condition is
My query is returning this
2 10 150000 where 2=startingslab and 10 = endingslab
11 20 250000
21 31 150000
now i want to get the price details for startingslab =3. i.e 15000.I know i need to process it row by row as between is not working.
Is there any ...
If I have the name of an index, what query can I use to find what table the index belongs to?
...
I need to "use a database" and create a table with the following attributes in SQL Server 2005:
Table name is "quiz_mailing_list"
Fields are:
id (typical auto-increment primary key)
email (varchar size 256)
optIn (boolean or tinyint size 1)
referringEmail (varchar size 256)
Can someone give me the command to "use the database" and the ...