Scripts

Technical Article

Find Tables that need Statistics Update

Indexes and table Statistics play a big role in an OLTP database for better query performance. Maintaining statistics on a weekly basis is important but a heavily updated database tables need more emphasis on Statistics and frequent updates. Instead of trying to issue “sp_updatestats” for the entire database, you can choose tables which are heavily […]

5 (1)

You rated this post out of 5. Change rating

2004-02-17

1,902 reads

Technical Article

Copy rows generator

This stored procedure is created from the need to copy rows from a table with new value. The script itself will create stored procedure proc_copyrows.The parameters are@TableName: the table name@FilterField: filter field, default is null, means no filter@SourceValue: the value of filter field from source data to be copied@DestinationValue: the new value of filter field@SourceDB: […]

You rated this post out of 5. Change rating

2004-02-13

254 reads

Technical Article

Global String Search & Replace In All DB Fields

Stored procedure to search every field in the database for a string literal.  Run the stored procedure in Query analyser, which will output sql statements to do the search.  The output of these searches will be the update sql, which again should be pasted into a query analyser window.  As the stored procedures do not […]

You rated this post out of 5. Change rating

2004-02-10

253 reads

Technical Article

SQL Server Log Reader

This script outputs the data in chronological order from the current SQL Server log.Output columns are: Log Entry Time, Event Source, Log Entry Text. This data matches with the data that can be seen under the SQL Server logs view in Enterprise Manager.The script is stand alone, but could easily be parameterised to work as […]

You rated this post out of 5. Change rating

2004-02-10

866 reads

Technical Article

XTAB - CROSSTAB UTILITY

sp_XTAB (prototype) produces pivoted (crosstab) views/output with a minimum of fuss.No messing with code, just tell XTAB what you want to pivot.Tested to 764 pivoted columns, XTAB can generate up to 63000 characters of dynamic sql. Example (deliberately over-simplified)----------------------updated 27 January 2004Use NorthwindEXEC sp_XTAB 'Northwind','xtEMPL_COUNTRY','Orders','EmployeeID','ShipCountry', '', 'OrderID','COUNT','NULL', '', 'SELECT xtEMPL_COUNTRY.* FROM xtEMPL_COUNTRY' -- Include optional […]

You rated this post out of 5. Change rating

2004-01-24

384 reads

Technical Article

Check if IP address is in private IP range

Function to allow for checking if an IP address is a private IP address.  Will convert the IP to a bigint equivalent if within the private range, otherwise it will return null if IP is a public address.Requires function IPStringToNumber which is included in the post

5 (1)

You rated this post out of 5. Change rating

2004-01-23

1,241 reads

Technical Article

Foreign Key DDL wizard

This script can be run when you want to do batch processing on a database, such as a dynamic truncate statement for all tables in your database.  This script will actually script all the Foreign Keys in your database, and then store them into a table called FOREIGN_KEY_TEMP.  It will then generate, and execute, all […]

You rated this post out of 5. Change rating

2004-01-22

247 reads

Blogs

Spark Connect Dotnet November 2024 Where are we?

By

All Spark Connect Posts Introduction There have been quite a few changes in the last...

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...

Read the latest Blogs

Forums

Writer methods in PowerQuery (LOL)

By pietlinden

In Python, I can write the contents of a pandas dataframe to a file...

Need help with GROUP BY...

By iamjoe

Here's my data... I am trying to return total days in status for each...

Need help with GROUP BY...

By iamjoe

Here's my data... I am trying to return total days in status for each...

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