sql-server-2005

metrics in ASP.NET application

I need to add some metrics and statistics capabilities in ASP.NET application (Framework 2.0, SQL Server 2005). It's Intranet application, so I can't use Google Analytics. I need not only measure number of hits and visits, but also which buttons people are pressing and which functions of application are using. Will it be enough to use ...

SmoApplication.EnumAvailableSqlServers fails to return all servers

My application lists the available network SQL Servers using Return SmoApplication.EnumAvailableSqlServers(false) Until recently, I was running XP Pro, with SQL 2005, SQL 2008, and Visual Studio 2008. All worked perfectly, correctly listing the default SQL05 server, and the SQL08 named instance. I've now upgraded to Windows 7 x64, ...

SQL Server Questions

How do I rename a database in Server Explorer on Visual Studio 2008? I changed the filename using Rename on the context menu, but that just changed the filename, not the name in SQL Server (2005 Express). Also, is there an easy-to-use management tool like PHP MyAdmin that I can use? Or is it easier to just use VS 2008 Server Explorer? ...

Check constraints in Ms Sql Sever 2005

Hi , I am trying to add a check constraint which verity if after an update the new value (which was inserted) is greater than old values which is already stored in table. For example i have a "price" column which already stores value 100, if the update comes with 101 the is ok, if 99 comes then my constraint should reject the update p...

Auto Increment userdefined id

Hi can anyone give me an idea how to create an auto generated id like ED01,ED02 etc., so that when i am entering data the id should be automatically incremented ...

Finding unused columns

I'm working with a legacy database which due to poor management and design has had a wildgrowth of columns which never have been or are no longer beeing used. Is it possible to some how query for column usage? As in how often a column is beeing selected (either specifically or with *, or joined on)? Seems to me like this is something w...

How can I create a disabled trigger in SQL Server 2005?

When using Oracle you can create a disabled trigger specifing the word DISABLE before the trigger body. How can I achive the same effect in Sql Server? ...

debug sql stored proc in VS 2008 from within asp.net code

I have a SqlDataSource that calls a stored proc. When the page loads a Gridview loads that uses that SqlDataSource. At this time I want to be able to debug the stored proc. I DON'T want to debug the stored proc on it's own. I want to see what values are actually being passed to the stored proc and what it is actually doing. ...

Undo changes made by SQL Server Database Tuning

I am not sure if this question can be asked here or serverfault. I was wondering...Is there is a way to quickly undo the changes made by SQL Server 2005 Tuning Advsor other than recovering from a backup? ...

MS SQL Server 2005 Copy data from one table to another

Hey all, I am trying to find out how to copy data from one table to another database table. I have two connections to two different databases. Ones called comp-DEV1 and the other SQLTEST. I am currently unable to copy data from my sorce table (SQLTEST) to my destination table (comp-DEV1). This is the error: Msg 102, Level 15, State ...

Querying by a value in XML in SQL Server 2005

Let's say I have a column in a table where the datatype is XML. I have a specific value I want query for in an xml tag that is unique(no repeating) in the XML. How do I do this? Something like: select * from MyTable where XMLColumn.TagImLookingAt.Value = @QueryValue ...

SSRS - Severe error message when running stored procedure

I have a report that runs a stored procedure that takes about an hour to run. After about 30 minutes I get this error message on the report body: An error has occurred during report processing. Query execution failed for data set 'DEV'. A severe error occurred on the current command. The results, if any, should be discarded. Operation ...

Relationship in SQL Server 2005?

My situation is i have four tables Patient, Receipt, Clinic and Laboratory. CREATE DATABASE TestHosp GO USE TestHosp GO Information about patient CREATE TABLE Patient (Id INT Not NULL PRIMARY KEY IDENTITY(1,1), FirestName VARCHAR(12) NOT NULL, LastName VARCHAR(12) NOT NULL, Birthday DATETIME) CREATE TABLE Clinic (Id INT N...

how to use like keyword in sql query

I have a sql query shown below i want to use the variables streetname, keyword1,radius and perform the sql query using like keyword but their is some problem with query syntax can anyone help protected void CreateXML(string keyword1, string streetname, string lat, string lng, string radius) { SqlConnection con = new SqlCon...

Backup sql server logins and users

Need to backup Database Users and Logins for particular database from prod server and restore it to Dev server ?hw can i proceed ...

Error on calling of Stored Procedure

I Create this stored procedure ALTER PROCEDURE [dbo].[Stock_Master_Sp] @common nvarchar(1)='', @PK_ID int=0, @FK_StoneCategory_Master int=0, @FK_StoneType_Master int=0, @FK_StoneName_Master int=0, @StoneSize nvarchar(50)='', @StoneWeight nvarchar(50)='', @FK_StoneShape_Master int=0, @StoneStrange int...

How to use" HAVING "and "ORDER BY" clause in sql

I have sql query like shown below the sql server says that their is error in HAVING and ORDER bY is their any error with syntax near HAVING and ORDER BY, can anyone help. SELECT Id, Name1, ZipCode, StreetName, StreetNumber, State1, Lat, Lng, Keyword, ( 6371 * ACOS( COS( (12....

Error with where clause in sql query

I have following sql query when i execute it zero rows are displayed i have feild called distance with value null in it , when i execute this query the distance feild will be filled with some numerical value but if i specify condition distance<2 or distance <10 or ... same result gets displayed can i know the whats problem. SELECT Id,...

Preventing overlapping appointment times

Hello All, I have a confusing little problem in SQL-Server 2005 and Classic ASP. I have the following table in the database +-----------+----------+----------+--------------+-------------------------+-------------------------+--------------+ | ProgramID | SystemID | ClientID | ProgramName | ProgramStart | ProgramEnd ...

Listing users and their roles in SQL Server

I want to get a list of all the users in the SQL server database and their roles. What I'm trying to do is to find out if certain users have privileges to more than one database. Is there a query which can do this directly? ...