Scripts

Technical Article

Encryption Example

Here in this T-sql tip I'am trying to compare the word "Hijacker" with two cases(line 3 and 4). Now they are in same when you compare the case (letter to letter), now you change the case of word "Hijacker" in either of the lines and run this SQL statements it will return different results. This […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2002-01-05

707 reads

Technical Article

Shrink DBs - Job Script

I'm posting this job script because it gets used by my scheduler script. It simply enumerates through each database on the server, and then executes a DBCC SHRINKDATABASE. The only wrinkle here is that I have it do a quick check to make sure that certain jobs are not already running.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2002-01-04

1,220 reads

Technical Article

Transaction Logs - Job Script

I've included this job script, because it is used by the scheduler scripts that I've also posted. This job is a little more involved than most may need... It first checks to see if certain jobs are running. Is so, it waits for a while, and then checks again. After that it drops the existing […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2002-01-04

1,198 reads

Technical Article

Check Jobs Current State

I created this script in an attempt to better automate many different jobs that run each morning, as part of a datawarehouse build. I use it to not only tell me what jobs are currently running (so that I can manage how many I would like to run at a time), but what happened to […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(2)

You rated this post out of 5. Change rating

2002-01-03

1,320 reads

Technical Article

Generate Restore DB Scripts from prev backups v1.0

Using the the MSDB backup tables, will generate the basic disk RESTORE commands for a database. It will include the Full, differential and all associated log recovery commands for you. Run the stored proc in Query Analyser then copy/alter the output to recover your DB. Great if using EE is not your cup of tea. […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2002-01-03

397 reads

Technical Article

Port from Oracle's TRANSLATE Function

Here is a port from the Oracle's TRANSLATE function to T-SQL. It gets three arguments: a string to be searched, a string with a set of characters to be found and replaced, and another set of characters as the replacements. Example: SELECT dbo.TRANSLATE('ABCDE', 'BD', 'CE') It will return 'ACCEE'.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(2)

You rated this post out of 5. Change rating

2002-01-03

504 reads

Blogs

10 Decisions to Make Before You Create A Fabric Workspace

By

Creating a Fabric workspace takes about 30 seconds. Restructuring workspaces after people have built...

Flyway Tips: Object History

By

It’s a small change, but a handy one. Flyway Desktop (FWD) now includes the...

Car Update September 2026

By

Software is hard. While I love our Lucid Gravity, I realize that they are...

Read the latest Blogs

Forums

Alamat BCA KCP Cempaka Putih Telp:08218520153

By layanan_Bca88

WhatsApp CS 628218520153 Jl. Letjen Suprapto No.30 EF, RT.7/RW.2, Harapan Mulya, Kec. Kemayoran, Kota...

Alamat BCA KCP Menteng Telp:08218520153

By m4rt1n4

WhatsApp CS 628218520153 Jl. HOS. Cokroaminoto No.83, RT.3/RW.5, Menteng, Kec. Menteng, Kota Jakarta Pusat,...

Alamat BCA KCP Wahid Hasyim Telp:08218520153

By R4nt4u

WhatsApp CS 628218520153 Jl. K.H. Wahid Hasyim No.82, RT.15/RW.3, Kb. Sirih, Kec. Menteng, Kota...

Visit the forum

Question of the Day

Adding new column with DEFAULT II

Which number did the two COUNT(*) return:

DROP TABLE IF EXISTS #tmp
CREATE TABLE #tmp (id INT NOT NULL)

INSERT INTO #tmp (id) 
SELECT gs.value
  FROM GENERATE_SERIES(1, 5) AS gs

ALTER TABLE #tmp ADD my_value INT NOT NULL CONSTRAINT df_tmp_my_value DEFAULT 1

SELECT COUNT(*)  FROM #tmp AS t WHERE my_value = 1

ALTER TABLE #tmp DROP CONSTRAINT df_tmp_my_value

ALTER TABLE #tmp ADD CONSTRAINT df_tmp_my_value DEFAULT 2 FOR my_value

SELECT COUNT(*)  FROM #tmp AS t WHERE my_value = 1

See possible answers