sql-server-2005

SQL Server Reporting Services 2005 - How do you hide the legend label for a chart?

I am reporting on data that lets say has 10 columns. Now some of my clients have data in all 10 of the columns whereas some may only use 7 or 5... you get the idea. Of course I dont want to have to build a new rdl for each possibiliy. Well in the tabular report I can hide the columns fine if no data exists by using the IsMissing prope...

How can a Table's Last Modified date be returned in SQL Server 2005?

How can a Table's Last Modified date be returned in SQL Server 2005? I did see one on the Table Properties page. There is a Created Date but no Modified date. If it is not available, what would be some other ways to add this functionality? Here are a few that come to mind: Add another column, to the table, that a trigger would upda...

How to remove diagramming support objects from SQL Server?

I need to remove diagramming support tables, stored procs, views, etc from SQL Servrer using TSQL script. Is there such a script available? SQL 2005 and 2008. ...

How do you migrate SQL Server Database Diagrams to another Database?

My team recently rebuilt their SQL Server 2005 development database from scratch using the TFS source files. Afterwards, we had a nice clean database that more closely matched our test and production environments. However, we also lost the database diagrams that had been created over the months in the old development database. Does any...

What is your biggest SQL Server mistake or embarrassing incident?

You know the one I am talking about. We have all been there at some point. You get that awful feeling of dread and the realisation of oh my god did that actually just happen. Sure you can laugh about it now though, right, so go on and share your SQL Server mishaps with us. Even better if you can detail how you resolved your issue so ...

Self-referencing constraint in MS SQL

Is it true that MS SQL restrict self-referencing constraints with ON DELETE CASCADE option? I have a table with parent-child relation, PARENT_ID column is foreign key for ID. Creating it with ON DELETE CASCADE option causes error "Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths. Specify ON DELETE N...

Dynamic Query in SQL Server

Hi, I have a table with 10 columns as col_1,col_2,.... col_10. I want to write a select statement that will select a value of one of the row and from one of these 10 columns. I have a variable that will decide which column to select from. Can such query be written where the column name is dynamically decided from a variable. ...

What good are SQL Server schemas?

I'm no beginner to using SQL databases, and in particular SQL Server. However, I've been primarily a SQL 2000 guy and i've always been confused by schemas in 2005+. Yes, I know the basic definition of a schema, but what are they really used for in a typical SQL Server deployment? I've always just used the default schema. Why would I ...

How can I get dbX.dbo.procA to run in the context of dbY?

I want to separate a specific set of stored procedures into a seperate database … sort of like a library. However, when I run these procs from another database, they appear to call objects from within the library database. Here is some source code which demonstrates the problem use mylibdb go create proc gettablecount as begin de...

SQL Query with accents from Foreign Languages

Hello, I have a simple column filled with words, many from foreign languages, I need to query based on the "English" letters, ie E, e, é, è, etc should be returned for query of "E" so école should be returned as a result which exists in the database when I query for "E" I can't really find a way to Google this, so help would be gre...

ASP.net application can't connect to sql server 2005 database.

Here is the scenario: IIS 6 and SQL Server 2005 on same machine: I have just created a new application inside of my main website in IIS. The root website has its own database. The application I just created under the root site has its own database, as well. ASP.net pages in the root site connect to their database using trusted securi...

How to execute sp_send_dbmail while limiting permissions

Is there a way to provide access to users in my database to execute msdb.dbo.sp_send_dbmail without needing to add them to the MSDB database and the DatabaseMailUserRole? I've tried this: ALTER PROCEDURE [dbo].[_TestSendMail] ( @To NVARCHAR(1000), @Subject NVARCHAR(100), @Body NVARCHAR(MAX) ) WITH EXECUTE AS OWNER AS BEGIN ...

High PF Usage on SQL Server

We are running SQL Server 2005 on 64 bit. The PF Usage reaches close to 25 GB every week. Queries that normally take less than a second to run become very slow during this time. What could be causing this? After running PerfMon, the two counters, Total Server Memory and Target Server Memory show 20 GB and 29 GB respectively. Processor Q...

How to create several stored procedure using SQL

Hi, I have a vb.net function that creates several Stored Procedures based on parameters being passed into the function. I want to move this vb.Net into a single SQL file (for maintenance reasons) but I am not sure how I can re-create it in SQL without creating 7 separate stored procedures. I create a total of 20 Stored Procedures and ...

How to identify performance and concurrency issues on an ASP.NET / IIS / SQL Server website

I would appreciate any advice regarding tools and practices I could use to confirm my recently completed website is performing correctly. Although I am confident the code is not producing errors and is functionally operating as it should, I have little understanding of how to identify IIS, SQL Server and Windows performance/concurrency ...

Database file-level encryption

We recently were given a client requirement to encrypt all their data while at rest. They have agreed that encrypting the dbf, backup and trn files will suffice this need for them. My question is, do I need to encrypt the ldf file also? Is there any retrievable data in the ldf file that would require it to be encrypted? ...

Joining fact tables in an MDX query

Hello All, I am building and Anaysis Services project using VS 2005. The goal is to analyse advertising campaigns. I have a single cube with 2 fact tables factCampaign: which contains details of what people interviewed thought of an advertising campaign factDemographics: which contains demographic information of the people interviewe...

How do I use the OLE DB provider for Directory Services in a SQL Server Integration Services project?

I can setup a connection manager that uses the Directory Services OLE provider and points to one of our domain controllers. Then, in the Data Flow area, I create a OLE DB Source and set the Data Access Mode to "SQL Command". I then use this query to pull data from Active Directory: Select employeeid, sAMaccountName From 'LDAP://MyComp...

How do you make sql server jdbc calls to stored procedure use a server side cursor?

I am using JDBC to call a stored procedure in MSSql 2005. I would like to have the result set make use of server side cursors to limit the amount of memory used by the client. I am able to do this easily using a simple query and setting the SelectMethod=cursor on the connection. When I put that query in a stored procedure, it appears ...

Best practices for dealing with encrypted data in MSSQL

I have some data in my user database that I would prefer to be encrypted. Most of the data will need to be decrypted when requested, but there are also passwords that can stay encrypted (in the old days we would use pwdcompare but I believe this is obsolete now). I have followed the steps here, so I have now successfully encrypted my da...