Scripts

Technical Article

Selecting XML out

I have a table with multiple rows for Description belonging to one Heading. For each row of data I need a .The xml should look like this: A heading 234567890123456789010 234567890123456789010 234567890123456789010   ...(to ) A heading 234567890123456789010 234567890123456789010   ...(to )

You rated this post out of 5. Change rating

2003-10-03

291 reads

Technical Article

Creating a Dynamic Crosstab Query

Crosstab queries (also called "pivot tables") in which you know beforehand the number of column values to aggregate by, can easily be performed in T-SQL using CASE statements wrapped in the SUM function.  Where things get tricky, however, is when you don't know how many aggregation values exist, and you are required to write a […]

5 (2)

You rated this post out of 5. Change rating

2003-09-26

3,563 reads

Technical Article

SP_HELPTEXT Modified for XML

This is the standard sp_helptext from SQL Server 2000 modified slightly to return the object definition as an XML document.The document is structured in the following format:I admit it was not a lot of work since I merely modified the final SELECT statement from Microsoft's own procedure, but I still find this very useful.The only […]

You rated this post out of 5. Change rating

2003-09-26

197 reads

Technical Article

Haversine Calculation in User Defined Function

Uses the haversine formula to calculate distance between 2 long / lat points.  This can be used with a zip code / lat and long table that are available from the census bureau or post office.The @R can be tweaked dependent on what gives you the best result (its the radius of the earth, fluctuates […]

You rated this post out of 5. Change rating

2003-09-25

732 reads

Technical Article

Optimized prime number generator

This a modification to the script given by Preethi.It generates prime numbers to the upper bound you specify.Modifications are using following facts from algebra:1. All prime numbers greater than 3 can be written in the form 6 * X +/- 1.2. Instead of checking the module for ALL numbers

You rated this post out of 5. Change rating

2003-09-25

370 reads

Blogs

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Create a Numbers Table in Power Query

By

This is a quick blog post, mainly so I have the code available if...

Microsoft finally adds Tenant Switcher for Fabric / Power BI

By

Praise whatever deity you believe in, because it’s finally here, a tenant switcher for...

Read the latest Blogs

Forums

It's The People

By Grant Fritchey

Comments posted to this topic are about the item It's The People

To View or not to View, that is the question...

By pietlinden

I've read lots of the horror stories about nested views in databases where they're...

Grant user read-write permission to a single database

By PJ_SQL

Hello! How do I grant a user to read-write to a single database and...

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers