dcsimg

Standardize Titles and Headings

October 5, 2000

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










The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers