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
>
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
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
"Joh" <joh@.mailcity.com> wrote in message
news:%235HNgnSYFHA.228@.TK2MSFTNGP12.phx.gbl...
> 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
> 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
>
|||You are right. Thanks
"Cristian Lefter" <nospam_CristianLefter@.hotmail.com> wrote in message
news:ONgxYpcYFHA.2768@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> 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
> "Joh" <joh@.mailcity.com> wrote in message
> news:%235HNgnSYFHA.228@.TK2MSFTNGP12.phx.gbl...
over
>
No comments:
Post a Comment