Standardize Titles and Headings | Database Journal

Standardize Titles and Headings

Written By
Alan Enderby
Alan Enderby
Oct 6, 2000
1 minute read

Here’s a script that will help you standardize those titles & headings.

Drop proc
rp_title
go
create proc rp_title
@t varchar(255) , /* Title to box
& display */
@s char(1)=’*’ , /* Box character */
@center bit=0 , /*
Center text in box */
@lpad int=0 , /* Shift box to right */
@timestamp
bit=0 , /* display date/time */
@date_format int=0 /* format for date/time
*/
as

DECLARE @pad varchar(80) SELECT @pad=”
IF @lpad>0 SELECT
@pad=replicate(‘ ‘,@lpad)

IF @timestamp=1 SELECT @t=@t + ‘ (‘ +

convert(varchar(25),getdate(),@date_format) + ‘)’

DECLARE @c
varchar(255)
SELECT @c=@pad+replicate(@s,82) ,
@t=@pad+@s
+
convert(char(80),replicate(‘ ‘,case when @center=1 then

40-(datalength(@t)/2)else 1 end) + @t) + @s
PRINT ‘ ‘
PRINT
@c
PRINT @t
PRINT @c
PRINT ‘ ‘

RETURN 0

go
exec
rp_title ‘Hello there’,@lpad=0,@center=0,@s=’#’
exec rp_title ‘Hello

there’,@lpad=20,@center=0,@timestamp=1,@date_format=3
exec rp_title
‘Hello there’,@lpad=0,@center=1
exec rp_title ‘Hello
there’,@lpad=20,@center=1

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.