sql-server-2008-r2

SQL Server 2008 Running Procs: How to get the xp_cmdshell items?

I'm using this query to find some queries that have been running for a long time: SELECT sqltext.TEXT, req.session_id, req.status, req.command, req.cpu_time, req.total_elapsed_time FROM sys.dm_exec_requests req CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext order by req.total_elapsed_time des Currently, we have some xp_cmdsh...

Concatenated string column is not displaying properly in dropdown list(asp.net)

Hi all, Below is my query which is in Storedprocedure(SQL Server 2008) will return list of items from a table. Query: SELECT ( COALESCE(ReviewDescription,'')+ REPLICATE (' ', 20 - LEN(ReviewDescription)) + '|' + ( CONVERT(VARCHAR(100),ReviewCharge))) AS ReviewTypes FROM ReviewType query result(copied to text pad then its looking l...

Does SQL Server 2008 Service Pack 2 Apply to SQL Server 2008 R2?

I've been using SQL Server 2008 R2 for my development. I noticed that service pack 2 for SQL Server 2008 just came out. However, I checked here and Microsoft does not provide a link to any of the service packs for SQL Server 2008 R2. So it is not clear to me whether or not I should apply their service pack to my instance of SQL Server 20...

What is the best way to loop over a table's rows?

Hi, What is the best way to loop over a database table's rows in SQL Server 2008 R2? I am looking for something which is fairly similar to writing foreach ( ) and quite performant. Thanks ...

How to render a report using the ReportService2010 namespace

I'm working on a project where we will be interacting with the ReportService2010 reporting web service under SQL Server 2008 R2. In the past, I've worked with the ReportService2005.asmx, and my problem here is, I can't find any reasonable examples on how to render a report with this new (2010) reporting web service. When using the 2005...

Can Unicode compression in SQL 2008 R2 cause GUIDs to become corrupt?

We recently had some trouble with our production SQL 2008 R2 databases and had to failover to log-shipped warm spares for most of our databases. This morning I found some very odd GUID values scattered throughout our set of databases. For background, we have a main clients database, that holds various information about installed clients,...

How to prevent Data Generation Plan timeout expired error

I'm attempting to populate a DB on my local SQL2008 Server using a Data Generation Plan. However, when I run it I get: Data generation failed because of the following exception: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. occurred 1 time(s). I've tried setting...

How to add surrogate key to related tables?

I need to add a auto-inc surrogate key to three tables in my data warehouse: Note: These are not the real table names JakMaster (JakMasterId, Date) (PK) Note: JakMasterId is varchar(60) JakToRoad (JakMasterId, Date) (FK) JakToBig (JakMasterId, Date) (FK) What steps should I take to add a surrogate key to these three tab...

Is it possible to have a nvarchar(max) and a varbinar(max) fields in same table

I am using SQL Server 2008 R2. I have a table which has several fields including a nvarchar(max) field. When I try and add a new field of type varbinary(max) I get an error message: "Saving changes is not permitted. The change that you have made requires the following tables to be droped and recreated". Is it possible to have a nvarch...

SQL Server - can I load MDF without LDF file without losing data?

Hello all, I have a backup database file (i.e. test.mdf), however, I don't have the LDF file. I was told that SQL Server 2008 R2 can load MDF without LDF. Is that true? Thank you ...

I need to create the same database on many server instances

SQL Server 2008, Visual Studio 08 and C# The task is to create the same database on multiple servers. If it were only two or three tables I would have done it manually but there are more than 50 tables in the database.. So I thought why not create a backup and restore the backup file wherever needed error the file is in use! ( altho...

Compute hash-value of entered value when insert or update using sql server 2008 by triggers

Hi, i have a table with two column {FlatContent, HashedContent}. Now i want to automatically compute hash value of FlatContent when new row was inserted or an existing row was updated. To date, i'm never used from trigger, so i can't do this by trigger or another approach which is exist to solve this issue. Thanks if anybody can help me...

Upgrade from SQL2008 to SQL2008 R2 caused problems with complex reporting services report

After upgrading our report server from SQL2008 to SQL2008 R2, one of our complex production reports will no longer work properly. This report has several parameters such as selecting all data or a specific group of data, and selecting summary data only or detail along with the summary. Since going to R2, if we select a small group detail...

SQL query problem when upgrading from SQL Server 2000 to SQL Server 2008 R2

Dear all, I am currently upgrading a database server from SQL Server 2000 to SQL Server 2008 R2. One of my queries used to take under a second to run and now takes in excess of 3 minutes (running on faster a faster machine). I think I have located where it is going wrong but not why it is going wrong. Could somebody explain what the ...

preventing a specific record from being deleted

I want to prevent a specific record from being deleted. This trigger works fine for that specific record. However, other records still remain when they're being deleted. Why? ALTER TRIGGER [Globalization].[CountriesTracker] ON [Globalization].[Countries] INSTEAD OF DELETE AS BEGIN SET NOCOUNT ON; IF ((Select COUNT(*) from [Delet...

Inserting new record by stored proc

I want to insert/update record with a specific stored-procedure which performs some business-logic on new record values. I can do this by trigger to ignore new record from directly to be inserted and pass new record values to my stored-procedure to perform appropriate action for passed values? ...

How do I stop SQL Server 2008 R2 trying to install some package when I build my setup project?

I have a WPF Linq-to-SQL project which I have been developing using MS Visual Studio 2008. I was running SQL Server 2008, and recently upgraded it to version R2. Now, whenever I build my SETUP project (not the app itself), the build process causes a window to launch: SQL Server 2008 R2 Management Studio Please wait while Windows configu...

Most usual approach to multiple inserts and updates on database

I would like to know what's the optimal approach to make a batch insert/update from CLR to SQL Server 2008 R2 database? Optimal in terms of: code complexity - I don't want to over complicate my TSQL or CLR code to prove it can be done implementation simplicity speed - it should perform better than doing one-by-one processing We usua...

How to use variables in SQL Reporting 2008 R2

I want to populate a combo box with a list of dates from a DB. Then based on user input I want to be change the Tablix to filter on only dates later than the selected date. How can I do so? Detailed steps will be useful. ...