Tag: sql-server-2005

SQL Server Login

What is the SQL query to check whether particular SQL Login is Enable or Disable?

Degree of C# support in SQL CLR user-defined function?

This may be naive but I cannot get any confirmation of this: When I write a SQL function via the SQLCLR and as a C# SQL Server Project, can the SQL function include any method/class/namespace in the .NET BCL? Are there any restrictions on what the function can do? I have full control of the […]

SQL Server: displaying first line of grouped records

Am trying to write a query that would output something similar to the last batch of records below. For sure it works in Reporting Services and Crystal Reports, but just throwing it out here to see if it is possible in SSMS/QA: Table: id name amount — —- —— 1 rob 23.00 2 rob 34.00 […]

How to get column which has least values among them

CREATE TABLE exmp_test ( id int, v1 int, v2 int, v3 int, v4 int ) SELECT * FROM exmp_test id v1 v2 v3 v4 1 2 4 6 7 1 4 77 3 8 I want to add the value of the [id] column to (whichever has least value for v1 ,v2 ,v3 ,v4) for […]

SQL Server 2005 simple update statment with join

I have 2 tables, one called dbo.dd and one called dbo.gt. where dbo.gt.v_products_model = dbo.dd.[Vendor Stock Code] I would like to update the field dbo.gt.v_products_price with the dbo.dd.[Dealer Ex] Sorry, forgot syntax of SQL 2005 and in a jam!

SQL Server 2005 XML to table

I’m using classic asp and I’m passing in a varchar (ado data type) into an xml data column in a proc. The xml looks as follows: <DocumentCriteria> <Document documentGUID=”{B49654E7-9AF2-4B89-AF8F-5146F7CD4911}” graderFYC=”5907″> <criterion cnumber=”1″ rank=”3″/> <criterion cnumber=”3″ rank=”3″/> </Document> </DocumentCriteria>’ I’d like to have a table that looks like this: DocumentGUID|GraderFYC|Cnumber|Rank {guid} | 5907 | 1 | […]

Faster way to find duplicate SQL query

I have a query to get duplicate data with some extra condition but I feel that it is not fast enough. Any solution to make this query faster? v_listing contains big information SELECT DISTINCT code, name, comm, address, area FROM v_listing t1 WHERE EXISTS (SELECT NULL FROM v_listing t2 WHERE t1.comm = t2.comm AND t1.address […]

grabbing first result set from a stored proc called from another stored proc

I have a SQL Server 2005 stored proc which returns two result sets which are different in schema. Another stored proc executes it as an Insert-Exec. However I need to insert the first result set, not the last one. What’s a way to do this? I can create a new stored proc which is a […]

How to list all duplicated rows which may include NULL columns?

I have a problem of listing duplicated rows that include NULL columns. Lemme show my problem first. USE [tempdb]; GO IF OBJECT_ID(N’dbo.t’) IS NOT NULL BEGIN DROP TABLE dbo.t END GO CREATE TABLE dbo.t ( a NVARCHAR(8), b NVARCHAR(8) ); GO INSERT t VALUES (‘a’, ‘b’); INSERT t VALUES (‘a’, ‘b’); INSERT t VALUES (‘a’, […]

Include in .net Application Setup File .. SQL SERVER 2005 Express

My application required SQL SERVER 2005 Express edition. So how can I make the application setup to include SQL setup and run behind setup.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.