Groups | Blog | Home
all groups > sql server clients > may 2005 >

sql server clients : Alignment result



Joh
5/25/2005 12:00:00 AM
USE PUBS
GO
CREATE FUNCTION [dbo].[GetSpace] ()
RETURNS int AS
BEGIN
RETURN (SELECT max(len(fname)) + 1 FROM employee)
END
GO
SELECT top 5 fname + SPACE([dbo].GetSpace() - LEN(fname)) + lname AS
Expr1, [dbo].GetSpace() AS Expr2, LEN(fname) AS Expr3
FROM dbo.employee

When I execute the query over the query analyzer it gave me the correct
result like that...

Expr1
Aria Cruz
Annette Roulet
Ann Devon
Anabela Domingues
Carlos Hernadez

When I execute the query over the Enterprise Manger > View > Create New View
[quoted text, click to view]
SELECT top 5 fname + SPACE([dbo].GetSpace() - LEN(fname)) + lname AS
Expr1, [dbo].GetSpace() AS Expr2, LEN(fname) AS Expr3
FROM dbo.employee

It gave the result on view pannel like that...

Expr1
Aria Cruz
Annette Roulet
Ann Devon
Anabela Domingues
Carlos Hernadez

I mean no alignment in the view pannel and when we call the same view over
the front end so it will gave the same unalign result.

Thanks

Cristian Lefter
5/26/2005 12:00:00 AM
GetSpace user function returns the appropriate number of spaces but in
Enterprise Manager the problem is the font used.
Copy the result from Enterprise Manager in a word editor (like Microsoft
Word) and set the font to Courier New and Size 10. You will see that the
results will be aligned. The default font for results in Query Analyzer is
Courier New and Size 10.

Cristian Lefter, SQL Server MVP

[quoted text, click to view]

Joh
5/26/2005 9:59:02 AM
You are right. Thanks


[quoted text, click to view]

AddThis Social Bookmark Button