sql-server-2005

Difference between SQL 2005 and SQL 2008 for inserting multiple rows with XML

I am using the following SQL code for inserting multiple rows of data in a table. The data is passed to the stored procedure using an XML variable : INSERT INTO MyTable SELECT SampleTime = T.Item.value('SampleTime[1]', 'datetime'), Volume1 = T.Item.value('Volume1[1]', 'float'), Volume2 = T.Item.value('Volume2[1]',...

How to backup SQL Server Agent jobs?

Possible Duplicate: How to backup SQL Server Agent jobs? Hi,I want to backup my sql server 2005 Agent jobs to another server, How can I backup and restore SQL Server 2005 Agent job schedules? ...

How do I get the desired result in T-SQL like ....

How do I get the desired result in T-SQL like .... like I have a Record like UseriD InDate outDate 1 3/12/2010 3/12/2010 1 3/12/2010 3/13/2010 1 3/19/2010 3/30/2010 2 3/2/2010 3/3/2010 2 3/3/2010 3/4/2010 2 3/4/2010 3/29/2010 3 2/2/2010 2/28/2010 so...

Why can't I pass in a uniqueidentifier/GUID to a stored procedure

Hi I have this SP USE [TestDB] GO /****** Object: StoredProcedure [dbo].[sp_test] Script Date: 06/12/2010 11:47:27 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[sp_test] @id uniqueidentifier AS BEGIN select * from TestTbl where ProductId= @id END I then went to the SP with ms sql 20...

Generating Random Records Date Wise

I work for a non-profit organization where we send volunteers to aided schools everyday. I am creating a site to display this info and am using SQL server express. I want some help regarding a query so here's my first post We have 15 volunteers currently who will go to 4 different schools to teach. Here are some conditions: We have to...

i need to use string variable in the Proc in sql server database 2005

I have this procedure CREATE Proc [dbo].Salse_Ditail -- Add the parameters for the stored procedure here @Report_Form varchar(1) , @DateFrom datetime , @DateTo datetime , @COMPANYID varchar(3), @All varchar(1) , @All1 varchar(1) , @All2 varchar(1) , @All3 varchar(1) , @...

what the IIS featuer need to install or change in pc have windows 7 home to work sql server 2005 ssrs not work

what the IIS featuer need to install in pc have windows 7 home to work sql server 2005 (32 bit) ssrs not work i change all windows featuer in the PC what i need to install in pc ...

How to Insert into remote table using Linked server withint Transaction ?

Hi, My Linked server is setup correctly , I am able to perform below query. INSERT INTO [RemoteServer].[Table] SELECT * FROM [LocalServer].[Table] However when I do the same thing within transaction BEGIN TRAN INSERT INTO [RemoteServer].[Table] SELECT * FROM [LocalServer].[Table] COMMIT TRAN I get Errors like O...

How to make an SQL query to get some specific range of rows from Table

How to make an SQL query if there are 30 records in table and I want to pick rows from 12 to 20 where 12 and 20 are row numbers not Ids. Ids Code 5 ABC 6 SDF 8 WSA 10 FSD 15 IOP . . . . 80 AWS ...

Random select is not always returning a single row.

The intention of following (simplified) code fragment is to return one random row. Unfortunatly, when we run this fragment in the query analyzer, it returns between zero and three results. As our input table consists of exactly 5 rows with unique ID's and as we perform a select on this table where ID equals a random number, we are st...

Is The Transaction Log Truncated When Doing a Backup In Full Recovery Mode?

Is the database transaction log automatically truncated after we create a backup and the DB is in full recovery mode? Or do we need to make 2 different backups, let's say 1 in full recovery mode and a different one for the log file. ...

Extract whole SQL Server database to CSV file

It is possible to extract all tables and rows of each table with one query or software in microsoft sql server? thanks ...

How do I iterate through hierarchical data in a Sql Server 2005 stored proc?

Hi, I have a SqlServer2005 table "Group" similar to the following: Id (PK, int) Name (varchar(50)) ParentId (int) where ParentId refers to another Id in the Group table. This is used to model hierarchical groups such as: Group 1 (id = 1, parentid = null) +--Group 2 (id = 2, parentid = 1) +--Group 3 (id = 3, parentid = 1) ...

Best way to perform a SELECT statement and insert into the same table?

Does anybody have any suggestions on how to improve the following statements: insert into ProductInfo with (rowlock) (orderid, productname) select 66673, FileInfoId from ProductInfo with (nolock) where ProductId = 66671 and IsEligableForCopy = 1 and ProductFileInfoId >= 2768395941 and ...

Data Access from single table in sql server 2005 is too slow

Following is the script of table. Accessing data from this table is too slow. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Emails]( [id] [int] IDENTITY(1,1) NOT NULL, [datecreated] [datetime] NULL CONSTRAINT [DF_Emails_datecreated] DEFAULT (getdate()), [UID] [nvarchar](250) COLLATE Latin1_Ge...

sql server 2005 32 bit on win 2003 64 bit using only 2 gb

Hi, We have sql 2005 32 bit running on win 2003 64 bit box containing 5 gb RAM. Is there a way that sql starts using more than 2 gb? some switch or some setting in sql server? When I go to my sql server properties and try to increase the max server memory to > 2GB, it reverts back to old 2 GB. Thanks, Anand Correction - Guys: I nev...

SQL server 2005 remote connection problem

I installed SQL Server 2005 express on two computers. I installed SQL Server Management Studio Express on both computers. I ran each instance of Management Studio and connected to SQL Server using Windows authentication (one computer's connection example: "A-63A9D4D7E7834\SQLEXPRESS"). I created a database named "test1" and created a ...

Complex select query question for hardcore SQL designers

Very complex query been trying to construct it for few days with more real success. I'm using SQL-SERVER 2005 Standard What i need is : 5 CampaignVariants from Campaigns whereas 2 are with the largest PPU number set and 3 are random. Next condition is that CampaignDailyBudget and CampaignTotalBudget are below what is set in Campaign ...

SQL Server 2005 Reporting Services: How to count rows that are not null? Any hints for calculating totals?

Using Reporting Services in SQL Server 2005: Is there a way to count only records that are not null; similar to "COUNTA" in Excel? I would think this would be very simple process, but nothing I have tried has worked. For example, I have tried using the following expression for "Completed", which is one column I am trying to count: =count...

Variables to input in file name for Reporting Services subscriptions

Is there a list anywhere that lists all the variables I can use in file names for report subscriptions from within SQL Server Management Studio? I currently use @timestamp in my file names, but would like to use other options or even remove parts of the time stamp (for example, just use the date, not the time). ...