sql-server-2008

How does ANSI_NULLS work in TSQL?

SET ANSI_NULLS OFF seems to give different results in TSQL depending on whether you're comparing a field from a table or a value. Can anyone help me understand why the last 2 of my queries give no results? I'm not looking for a solution, just an explanation. select 1 as 'Col' into #a select NULL as 'Col' into #b --This query gives resu...

Is it possible to deny access to SQL Server from specific programs?

Currently one of our databases (SQL Server 2008) is accessed via a number of different mechanisms: .Net SqlClient Data Provider; SQL Server Management Studio; various .Net applications and 2007 Microsoft Office system (basically Excel). I see that in the sys.dm_exec_sessions DMV it is possible to see the program name of the program acc...

SQL Server 2008 to SQL Server 2005

I have an MDF and LDF file of SQL Server 2005. i attached it with SQL Server 2008 and did some change in data. now when i attached it back to sql server 2005 Express Edition it gives version error. The database 'E:\DB\JOBPERS.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrad...

Can SQL Server 2008 use a variable in a WHERE IN clause

Are there any updates in SQL 2008 to allow a variable for the IN of a where clause? Declare @InParams varchar(100) Set @InParams = '1,2' Select * from Category Where CategoryID in @InParams ...

How to preserve order of temp table rows when inner joined with another table?

Does an SQL Server "join" preserve any kind of row order consistently (i.e. that of the left table or that of the right table)? Psuedocode: create table #p (personid bigint); foreach (id in personid_list) insert into #p (personid) values (id) select id from users inner join #p on users.personid = #p.id Suppose I have a list of ID...

What tools are people using to measure SQL Server database performance?

I've experimented with a number of techniques for monitoring the health of our SQL Servers, ranging from using the Management Data Warehouse functionality built into SQL Server 2008, through other commercial products such as Confio Ignite 8 and also of course rolling my own solution using perfmon, performance counters and collecting of v...

How can I stop SQL Server Reporting Services 2008 going to sleep?

I have SSRS 2008 set-up on a server. All works fine except that if left inactive for a length of time the next time a request is made to the server it takes a long time for it to service it. I think this is to do with the worker process being shutdown after being idle for a certain length of time. However, as SSRS 2008 isn't managed t...

Optimising a query for Top 5% of users

On my website, there exists a group of 'power users' who are fantastic and adding lots of content on to my site. However, their prolific activities has led to their profile pages slowing down a lot. For 95% of the other users, the SPROC that is returning the data is very quick. It's only for these group of power users, the very same SP...

Sql 2008 Logins

Hello! I was wanderin what is the difference when login with: Server name:User Authentication: windows authentication and Server name:User\sqlexpress Authentication: windows authentication I'm asking because i wasn't able to give sysadmin role to the 'user\sqlexpress' but i could on 'User' Sorry for the question if it is too simple ...

Round .NET DateTime milliseconds, so it can fit SQL Server milliseconds

I want to convert the datetime value to the value that I will get from SQL Server 2008. SQL Server truncate the milliseconds to 3 digits, so I truncate the milliseconds already. But the problem is that as you can see here: http://stackoverflow.com/questions/634122/milliseconds-wrong-when-converting-from-xml-to-sql-server-datetime. SQL S...

How to find duplicate values in SQL Server

Hi, I'm using SQL Server 2008. I have a table Customers customer_number int field1 varchar field2 varchar field3 varchar field4 varchar ... and a lot more columns, that don't matter for my queries. Column *customer_number* is pk. I'm trying to find duplicate values and some differences between them. Please, help me to find all...

What kind of encryption mechanisms does SQL Server 2008 Standard offer?

As I see, TDE and EKM mechanisms are available only in Enterprise edition. How can I encrypt data in tables in Standard edition of SQL Server 2008? ...

SQL Server Notification Services

I know that SQL Server Notification Services is not included in SQL SErver 2008 , what is the alternative of this services in it ?? ...

Limit the number of rows returned on the server side (forced limit)

So we have a piece of software which has a poorly written SQL statement which is causing every row from a table to be returned. There are several million rows in the table so this is causing serious memory issues and crashes on our clients machine. The vendor is in the process of creating a patch for the issue, however it is still a fe...

SQL Script To Generate a Database Dictionary **With Linked Fields**

I would like to generate a Data Dictionary for a SQL Server 2008 database that has one row for each field, and the following columns: table_name field_name data_type link_table (for when the field in question is a foreign key) link_field (for when the field in question is a foreign key) I can get the first 3 columns with something like...

SQL Server 2008 alternative for SQL-DMO

Hi! I previously was using SQL-DMO to automatically generate scripts from the database. Now I upgraded to SQL Server 2008 and I don’t want to use this feature anymore since Microsoft will be dropping this feature off. Is there any other alternative I can use to connect to a server and generate scripts automatically from a database? An...

How do I set a SQL Server 2008 Reporting Services Template to a Default Font?

I'm creating a new template to create reports from at a later date. I know how to create one, and I know where to save it. However, the problem is this. Everything that is created on the report uses the default font of Arial with a size of 10pt. I need to set mine to default to Tahoma 11pt. I can create a mock title, mock tables, e...

How to use a data type (table) defined in another database in SQL2k8?

I have a Table Type defined in a database. It is used as a table-valued parameter in a stored procedure. I would like to call this procedure from another database, and in order to pass the parameter, I need to reference this defined type. But when I do DECLARE @table dbOtherDatabase.dbo.TypeName , it tells me that The type name 'dbOther...

How to Compare two strings using a if in a stored procedure in sql server 2008?

I want to do something like this: declare @temp as varchar set @temp='Measure' if(@temp == 'Measure') Select Measure from Measuretable else Select OtherMeasure from Measuretable ...

Sql Server Development Server and Live

I have a database project that goes through iterations (only one so far) and I need to deploy a testing version to a live server. I'm not sure how to go about this. I can make all the changes in a copy and then remake those changes in the live version. That doesn't make sense. Is there a way to change a server name to an existing ser...