Scripts

Technical Article

Date/Time formatting function

T-SQL analog for Visual Basic FORMAT function. Created for MSSQL 2000. Works regardless of language settins on server or client side! fn_format('YYYY/DD/MM HH:MI','2002-03-13 12:00') = '2002/13/03 12:00' fn_format('DD.MM.YY','2002-03-13 12:00:00') = '13.03.02' fn_format('HH:MI:SS','2002-03-13 12:00:00') = '12:00:00'

You rated this post out of 5. Change rating

2002-02-05

968 reads

Technical Article

Run a blackbox trace

There is a script for setting up a blackbox trace on SQL 2000 described by Kalen Delaney in "Inside SQL Server 2000". Since I can never remember where to look it up I wrote this simple stored procedure to run the blackbox trace when I need it. This should be used with caution as it […]

You rated this post out of 5. Change rating

2002-02-05

624 reads

Technical Article

Splitting string of values to table

This function can convert string with separated values to table. Exclusive feature: items inside quotes will not be splitted! Now you can easily perform joins on CSV strings! For expample: fn_split('1, 2, ''3, 4'', 5',',')= 1 2 3, 4 5 First parameter - string with values, second - delimiter character.

5 (1)

You rated this post out of 5. Change rating

2002-02-05

1,177 reads

Technical Article

Auditing Solution - Generate Triggers automatically

The procedure looks at the table you want to be audited and writes the INS, UPD, and DEL triggers automatically required for the auditing to work. The auditing requires a table called Progress to hold the audit information in so have provided the DDL for this as well. Typically you would write a cursor to […]

You rated this post out of 5. Change rating

2002-02-04

481 reads

Technical Article

Procedure Search by Keyword(s)

Searches SysComments for occurances of entered keywords and returns a list of procedures that contain the keywords. eg1) To find all procedures with 'nMyColumn' in EXEC utl_ProcSearch 'nMyColumn' eg2) To find all procedures with 'nMyColumn' in and 'nMyColumn2' in EXEC utl_ProcSearch 'nMyColumn', 'nMyColumn2' eg3) To find all procedures with temporary tables in... EXEC utl_ProcSearch '#' […]

You rated this post out of 5. Change rating

2002-02-04

197 reads

Technical Article

Get list of files from dir and put in table

This stored procedure reads the file names from a directory and stores just the names in a given table. It returns also the number of files present. The sp uses xp_cmdshell and so permissions are restricted to sysadmins and SQLAgentCmdExec. You can test with the following: Create Table ##tmp2 ( fldx nvarchar(255) ) Declare @FilePath […]

1 (1)

You rated this post out of 5. Change rating

2002-02-01

1,960 reads

Technical Article

Stored procedure to expose information for a file

I wanted to be able to use info about an operating system file in TSQL. So I wrote this stored procedure that uses the special stored procedures xp_fileexist and xp_getfiledetails. This can tell if a file or folder exists, and if it is a file what is its size, created date and time, last written […]

You rated this post out of 5. Change rating

2002-02-01

1,227 reads

Technical Article

SP to import to a file

Is a SP that imports a table to a file. You just put the table name, the path and the sa password and then you have it. It is important that it parse the table inserted (pubs.dbo.sales for example) and checks that the db, the table with the owner exists

You rated this post out of 5. Change rating

2002-01-28

1,678 reads

Blogs

Master the Foundational Basics

By

It tells us to take the time to master the foundational basics of whatever...

Simple Talks Episode 9–Data masking and subsetting

By

The episode on data masking and subetting is out. You can see it here:...

T-SQL Tuesday #180: Avoid Perfect for Good Enough

By

I'm listening to Effortless by Greg McKeon (link to author's page) through Audible.com. He...

Read the latest Blogs

Forums

ssrs order of operation question

By stan

hi i need "sample size" in my report's 4th data region which is a...

Query Network Protocols from T-SQL or PowerShell

By webrunner

Hello experts, I want to be more organized about the SSL certificates we have...

Occasional Sql Server 2019 slowness (upgraded from 2014) -- please help...

By jellybean

Hi everyone, We recently upgraded our server to Sql Server 2019 (15.0.2125.1 (X64) on...

Visit the forum

Question of the Day

The Hash Join I

What are the two inputs called to a hash join operation in SQL Server? (choose 2)

See possible answers