T-SQL

Technical Article

Pass an Array into a Stored Procedure

  • Script

Have you ever wished T-SQL allowed you to pass an array into a stored procedure? Well the spListToTable stored procedure listed below accepts a delimeted string and turns it into a table. Code your stored procedure to accept a varchar, create a temporary table, call spListToTable, and use the populated temporary table as if it […]

4.25 (4)

You rated this post out of 5. Change rating

2001-12-10

2,859 reads

External Article

HOWTO: Run Singleton SELECT Queries in a Visual Basic Client

  • Article

This article demonstrates how to retrieve a single record from SQL Server by using the IRow interface with a singleton SELECT. The main purpose for this technique is to avoid the overhead of creating a recordset when you are fetching a single record. Because no recordset is actually created, only one read-only ADODB.Record is returned. This is true even if the specified SELECT results in multiple records being returned if a normal ADODB.Recordset is used.

2001-11-26

1,684 reads

Technical Article

Loop through records without using a cursor

  • Script

I sometimes have to loop through records in a database and perform a specific action on the value that is returned. For example, In the script below I loop through the user tables in sysobjects and simply print them out. This technique is useful when dropping all indices/triggers on a particular table, or adding WITH […]

3 (2)

You rated this post out of 5. Change rating

2001-11-25

9,178 reads

Technical Article

Update Foreign Key References

  • Script

This script updates all foreign key references for the specified table. Useful if you need to delete a row. The follow example would update all uses of TableA.IDENTITYCOL where the value is 1 to the value of 2. Example usage: EXEC usp_updateFK 'TableA', 1, 2

You rated this post out of 5. Change rating

2001-11-03

1,453 reads

Technical Article

Optimize Character Field Usage

  • Script

This stored procedure was designed to scan all your character based columns in a particular database and show the minimum, maximum and average data length. As well as give an efficiency rating of the data stored. Input: None Output: Table name, Column name, Defined datatype and length, Average length of data for that column, Minimum […]

You rated this post out of 5. Change rating

2001-08-10

1,679 reads

Blogs

SQL Server Wait Stats

By

Everything in SQL Server is waiting for something…this is by design. And most people...

FabCon 2025 Recap

By

Hey fellow data friends! Wow, March was an absolutely crazy month (in the best...

Privacy Policy

By

We value your privacy. This policy explains what personal data we collect and why. What...

Read the latest Blogs

Forums

Why would using a variable vs Hard Value impact a Query's Performance

By YSLGuru

Why would using variables in place of hard coded numbers impact a query's performance? ...

XML data import with poor stored procedure performance (needs optimization)

By Lord Slaagh

Hello SSC! I have been tasked with optimizing a stored procedure the imports data...

Trouble accessing hidden XML download link on Blazor-based government site

By Jobs90312

Hey everyone, I'm trying to access an XML file download from a government website...

Visit the forum

Question of the Day

Importing Flat Files

What types of sources can be used with the Import Flat File Wizard in SQL Server Management Studio (SSMS)?

See possible answers