Miscellaneous

Technical Article

fnCharPad

  • Script

This function allows the user to pass in a string / character value and it     will padd the value according to given parameters. The parameters are as follows:@ValueToPad = Value to be padded by function.@PadCharacter = Character used to pad a given value.@Justification = Justification format bit 0 - Value will be RIGHT justified […]

You rated this post out of 5. Change rating

2002-09-06

267 reads

Technical Article

Recompile all Udf's associated with a Table

  • Script

When altering the structure of tables it is good practice to run SP_RECOMPILE against the table to force triggers and stored procedures to recompile. However this does not incude Udf's which also rely on the table, and this means the Udf's may fail when they are called. Run this script and supply the table name […]

You rated this post out of 5. Change rating

2002-09-05

357 reads

Technical Article

Show valuable info from sysindexes

  • Script

This sp (sp_sysindexes) captures important columns from the table sysindexes and translates the numeric values into text. It shows the owner.object, the filegroup which it belongs to, the type of index, the total number of pages for tables/clustered indexes and non clustered indexes. It also shows the status, the indid and the type of object.You […]

3.5 (2)

You rated this post out of 5. Change rating

2002-09-01

3,717 reads

Technical Article

Compare the data of 2 Tables (Updated)

  • Script

The SP compares the data in 2 tables and reports the different data. Tables could be from different servers, different databases or different schemas. This accepts 7 parameters 1, 2: Name of the 2 tables 3 : List only the differences 4. : Compare only the structure 5. : Check timestamp fields too 6. : […]

5 (1)

You rated this post out of 5. Change rating

2002-08-17

1,382 reads

Technical Article

Using a MEMORY table as an array

  • Script

I liked the script of using a table as an array. But Didn't liked the cursor in it so I rewrote the script so that it uses a memory table.I tested it in the Query analyzer and this one is indeed faster. So all the people out there yelling that a memory table is faster […]

You rated this post out of 5. Change rating

2002-08-07

1,239 reads

Technical Article

Comparing Contents of 2 tables in T-SQL

  • Script

How can you compare two tables -- say, table A and table B  and determine if their content is the same? Assuming that A and B have same structure, here's how:First, from set theory, recall that: If ((|A| = |B|) && |A U B| = |A|)) ====>>>  A = B |A| = NUMBER of rows […]

You rated this post out of 5. Change rating

2002-08-07

1,485 reads

Technical Article

Retrieve every n values

  • Script

this scripts presents the way to retrieve from a given result set the values given n where n determines that the Nth value,2N th values , 3Nth value will be returnedin the example n = 3 the returning rows are 22,32,42the given set is 20,21,22,30,31,32,40,41,42

You rated this post out of 5. Change rating

2002-08-01

438 reads

Blogs

Modify Power BI page visibility and active status with Semantic Link Labs

By

Setting page visibility and the active page are often overlooked last steps when publishing...

T-SQL Tuesday #190–Mastering a New Technical Skill

By

It’s time for T-SQL Tuesday again and this time Todd Kleinhans has a great...

Getting Started with the MSSQL AI Agent in VS Code

By

Recently I was working in VS Code and I saw a walkthrough for the...

Read the latest Blogs

Forums

Password Guidance

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Password Guidance

Using table variables in T-SQL

By Alessandro Mortola

Comments posted to this topic are about the item Using table variables in T-SQL

Azure elastic query credential question

By cphite

I am trying to check out elastic query between two test instances we have...

Visit the forum

Question of the Day

Using table variables in T-SQL

What happens if you run the following code in SQL Server 2022+?

declare @t1 table (id int);

insert into @t1 (id) values (NULL), (1), (2), (3);

select count(*)
from @t1
where @t1.id is distinct from NULL;
 

See possible answers