sql-server-2005

T-SQL User defined function overloading?

I understand that T-SQL is not object oriented. I need to write a set of functions that mimics method overloading in C#. Is function overloading supported in T-SQL in any way? If there is a hack to do this, is it recommended? ...

How do I calculate the Azimuth (angle to north) between two WGS84 coordinates in a single T-SQL query?

I found the solution for this question in C#, but I can't translate it to a single query T-SQL, since my C# implementation requires branching (if then else). I also found the following C# solution, which could be translated to a single query T-SQL but it doesn't produce the correct results public static double GetAzimuth(WGSCoord c1, W...

help with FOR XML PATH('') escaping "special" characters

this code basically translates characters based on position in one string to the character at the same position in another string and it runs for all rows in the table. when I run this (simplified version): DECLARE @R char(40) DECLARE @U char(40) SET @R=' abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+'+char(181) SET @U=REVE...

debug ssis package - reload InnerPackage.dtsx

Hi all, I used the wizard to build a package that loops through my tables does whatever. It has worked forever and now I have to change it. How on earth do I debug this thing? When I try to run it from bids, it opens InnerPackage.dtsx for editing and then asks me if I want to reload it (since it has changed since the last iteration o...

Retrieve TOP X members of each group using SQL Server 2005

I've seen this question asked a couple of times, and I've written my own query, but it's quite slow, and I would be extremely grateful if someone could offer advice on how to speed it up. In a simplified scenario, I have the following two tables: Group - GroupID (primary key) Member - MemberID (primary key) - GroupID (foreign key) L...

SqlConnection in .NET -- How can i best harness connection pooling?

I read that .NET uses connection pooling. And, for example, if I instantiate a bunch of SqlConnection objects with the same connection string, then internally .NET will know to use the same connection. Is this correct? And, in a big web-based application, any tips on the best way to harness this "power" ? Thanks. ...

Whats the best SQL Query to get Related Items?

I have a small site where I want to get Related Videos on basis of Tags... what could be the best MS SQL 2005 query to get related Videos on basis of Tags. If you can give LINQ query that would be awsome. Here is Database Schema: CREATE TABLE Videos (VideoID bigint not null , Title varchar(100) NULL, Tags varchar(MAX) NUL...

Best SQL 2005 Query to get Related Items?

I have a small video site where I want to get related videos on the basis of the most matched tags. What would be the best MSSQL 2005 query to get the related videos? A LINQ query would be appreciated as well. Schema: CREATE TABLE Videos (VideoID bigint not null , Title varchar(100) NULL, isActive bit NULL ) CREATE T...

Updating report parameters based on perameter selection? (SSRS)

I've created a report in SSRS with two report parameters. I'd like the second to update it's values based on the selection in the first. The first is a list of sales agents, and the second is a list of distributors. Each agent can have many distributors. So if the report user selects an agent, I'd like only their distributors to show in...

unable to open object explorer in ssms 2005

hi, My comp name is ZM-DB48B9. I've two operating systems installed in my computer. What should I give as Server name when Authentication is "Windows Authentication"? Please help asap. ...

I have a Tags Table. How to Bulk Insert using LINQ?

I am using VB.NET with LINQ to MS SQL. I have two following tables. Now I want to insert multiple items in Tags Table using LINQ, but also wants to check that if any of tag exists in Tags table. It doesn't insert it again and bring the TagID in both cases (if inserted or if found existed) CREATE TABLE Tags (TagID bigint not null , ...

Case Sensitive Where Clause in LINQtoSQL?

I want to check whether a Tag (Case-Sensitive) exists in SQL Server 2005 table using LINQtoSQL. Let's say if a tag 'BEYONCE' exists in tags, then I want that I can add 'beyonce' or 'BeYOnce' but not 'BEYONCE' again. Here is the LINQ query i have written: From t In Context.Tags Where String.Equals(t.Tag, myTag, StringComparison.Ordinal) ...

Transaction commit executes succesfully but not getting done

I've encountered a strange problem in Sql Server. I have a pocket PC application which connects to a web service, which in turn, connects to a database and inserts lots of data. The web service opens a transaction for each pocket PC which connects to it. Everyday at 12 P.M., 15 to 20 people with different pocket PCs get connected to the ...

Using ASP.NET label as SSRS report parameter

I have SSRS report with its own datasets coming straight from the database. I have the report on ASP.NET application page. The application page header has the username and user region details defined in the master page. Now, I want to read this region id label from the ASP.NET page and build my report accordingly. Basically build...

Storing SSN/CC data

I read through quite a few similar questions here on SO but none were in quite the same situation as I am. Previously, user enters in a ton of info including SSN, Spouse SSN, and CC data. When the user completed the process, the info was pushed on PDFs, zipped up (which then got encrypted), and then FTPed back into our server. We save...

sql exception

What are the sql exceptions will thrown by using the following function: Read Update Write ...

SQL query to find Missing sequence numbers

Hi, I have column named "sequence" . I have data in this column like 1,2,3,4,5,7,9,10,15 . I need to find out missing sequence numbers from table . what is the sql query to find missing sequence numbers from table ? I am expecting results like 6,8,11,12,13,14 Thanks a lot EDIT I just need to return one column like Missing numbers ...

Master Table Information required for the Replication Process

In SQL Server 2005 while doing Replication (Snap Shot/ Transactional/ Marge Replication), what are the master tables are used ? ...

How do I combine/merge columns from two SQL query results?

I have a set of data in a table named BWHourlyReadings, for example: ServiceID Hour InputOctets OutputOctets ========= ==== =========== ================= 27222 1 383088 804249 27222 2 270529 688683 27222 3 247251 290124 ... up to 24 hours of data 27222...

limit of rows in SQL Server 2005 when performance degrades

What is the limit of rows in a table for SQL Server 2005, when SQL query starts getting slower? Is there any way to find out the limit? I understand it will depend upon the data length of a row. This will also depend on how many more data in other tables and the hardware available. ...