sql-server-2005

In SQL Server, how can I execute a piece of tsql against all databases in an instance?

Hi guys, In SQL Server, how can I execute a piece of tsql against all databases in an instance? Great thanks. ...

Displaying same record twice- SQL Reporting Services

Ok, here's the situation: I need to display the same record in two different sections. stupid i know, but here's why. The Report I am building is grouped by one Field, called Day. Each record has date/times, an expected arrival date time, and an expected departure date/time. so, at this point we have something like this: Day............

SQL Server 2005 Setup Problem

When I setup SQL Server 2005 this problem appear Minimum Hardware Requirement (Warning) Messages Minimum Hardware Requirement The current system does not meet the minimum hardware requirements for this SQL Server release. For detailed hardware and software requirements, see the readme file or SQL Server Books Online...

Trigger on database using a web application and a winform application

Hello all, Situation: I have a web application which shows errors and where you can accept those error messages. I also have a service, which checks errors from a system and sets the error messages in the database. When I accept an error in the web application, i would like the service to know which error message has been accepted, so t...

In SQL Server 2005, how can I use database_b, do something, then use the old db database_a in TSQL?

Hi guys, In SQL Server 2005, how can I use database_b, do something, then use the old db database_a in TSQL? The following is my code but there is some problem with it. Who can help me to identity the problem? Great thanks. DECLARE @old_database_name VARCHAR(200) SET @old_database_name = db_name() use mydatabase create table t1(id in...

Two Instances of Sql Server (2005 and 2008)

Hi All, I installed Visual Studio 2008 Professional in my machine and It had installed SQL Server Express 2005 database in machine, and I use it very fine! I installed SQL Managment Studio and works great. So, in this week I Installed Visual Studio 2010 Pro in machine and the setup installed the SQL Server express 2008 and it overwrite...

Integrate Lucene or any other search product with SQL Server 2005

Hi, I need to use full text search with SQL Server 2005 and I have explored its inbuilt search approach (SQL Server full text indexing) but it seems less powerful. I have also looked features of Lucene. Now my questions: Is is possible to integrate Lucene and SQL server in anyway? Can my T-SQL queries use Lucene index for returning ...

Selecting events from SQL Profiler in 2005 for profiling a query

Hi, I need to profile a large SQL query (in a particular database, not the whole server), and I cant figure out how to setup the profiler. I tried reading MSDN SQL web site, but it has not helped. I am stuck at the Trace Properties "Events Selection" window. I need help as to which items to select in "Events Selection" window. I am mor...

SSIS - 'Execute SQL' Task and Record Sets

Hi, How can I access a 'RecordSet' within a 'Execute SQL' task when using SSIS? I have looked at the parameter mapping options within the Execute SQL Task Editor and cannot find a type of object to allow me to pass the variable holding my record set to the task. ...

how to pivot rows to columns

Every example of using PIVOT in MSSQL shows people using this to aggregate data. I'm trying to exploit this to just simply transpose rows to columns For instance, consider the follwoing data SELECT 11826 ID,cast('64 ' as varchar(1000)) as answer,75098 QuestionID,2785 CollectionID into #temp insert into #temp SELECT 11827 ID,cast('S...

if else within CTE ?

I want to execute select statement within CTE based on a codition. something like below ;with CTE_AorB ( if(condition) select * from table_A else select * from table_B ), CTE_C as ( select * from CTE_AorB // processing is removed ) But i get error on this. Is it possible to have if else within CTEs? If not is there a w...

Hibernate Auto-Increment Setup

How do I define an entity for the following table. I've got something that isn't working and I just want to see what I'm supposed to do. USE [BAMPI_TP_dev] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[MemberSelectedOptions]( [OptionId] [int] NOT NULL, [SeqNo] [smallint] IDENTITY(1,1...

How to make a staging table in SQL Server 2005?

Hi I heard about doing staging tables and I am wondering how you actually do it. I want to do a SqlBulkCopy into a staging table. Then then update the real table. I heard in SQL Server 2008 that you can use something called merge but I am using SQL Server 2005 so I heard I have to use a update inner join? I am not sure how that would...

SQL Server performance issue.

Hi Friends, I have been trying to analyze performance issue with SQL Server 2005. We have 30 jobs, one for each databases (30 databases, one per each client). The jobs run at early morning at an interval of 5 minutes. When I run the job individually for testing, for most of the databases it finishes in 7 to 9 minutes. But when these j...

Can Visual Studio.NET 2008 integrate SQL 2008?

Visual Studio 2008 ships with SQL 2005. I would like to integrate SQL 2008. Are there significant reasons why one could not/ can not do this? ...

SQL Server 2005 sp_send_dbmail

Hi Friends, When we use sp_send_dbmail to send email with attachment, the attachment gets copied into a folder inside C:\Windows\Temp. As we have many emails to be sent every day, the temp folder grows rapidly. This is the case with SQL Server 2005. We noticed that, with SQL Server 2008, we dont see these file under temp folder. Is th...

Storing SQL queries in Table in sql server

We have multiple jobs in our system. These jobs are listed in a grid. We have 3 different user types (usertypeid 1,2,3). For each user listing is different and he can filter listing by selecting view from a dropdown. ViewName in the below table is the view which needs to be displayed. To achieve this functionality, a fellow developer...

how can i substitute a NULL value for a 0 in an SQL Query result

SELECT EmployeeMaster.EmpNo, Sum(LeaveApplications.LeaveDaysTaken) AS LeaveDays FROM EmployeeMaster FULL OUTER JOIN LeaveApplications ON EmployeeMaster.id = LeaveApplications.EmployeeRecordID INNER JOIN LeaveMaster ON EmployeeMaster.id = LeaveMaster.EmpRecordID GRoup BY EmployeeMaster.EmpNo order by LeaveDays Desc ...

Exit and rollback everything in script on error

Hey guys ! I'm in a bit of a pickle here. I have a TSQL script that does a lot of database structure adjustments but it's not really safe to just let it go through when something fails. to make things clear: using MS SQL 2005 it's NOT a stored procedure, just a script file (.sql) what I have is something in the following order BEG...

Validate data before uploading through SSIS

I have a SSIS package to upload data from Excel file into an Sql Server 2005 table. The excel file will have varied lines of data ranging from 20k - 30k lines. The upload works fine, when all the data are correct. But obviously fails when there is a small problem even in a single row. Examples like mandatory values presented null, inc...