<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>T-SQL</title>
        <link>http://blogs.ugidotnet.org/fgiossi/category/T-SQL.aspx</link>
        <description>Transact SQL</description>
        <language>it-IT</language>
        <copyright>Francesco Giossi</copyright>
        <generator>Subtext Version 2.6.0.0</generator>
        <item>
            <title>Clausola TOP n</title>
            <link>http://blogs.ugidotnet.org/fgiossi/archive/2008/04/23/clausola-top-n.aspx</link>
            <description>SQL Server:
SELECT TOP 10 product, descr, email 
FROM products 
 
ORACLE:
SELECT product, descr, email
FROM products 
WHERE ROWNUM &amp;lt;= 10

 
MySQL:
SELECT product, descr, email
FROM products
LIMIT 10&lt;img src="http://blogs.ugidotnet.org/fgiossi/aggbug/92359.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Francesco Giossi</dc:creator>
            <guid>http://blogs.ugidotnet.org/fgiossi/archive/2008/04/23/clausola-top-n.aspx</guid>
            <pubDate>Wed, 23 Apr 2008 21:48:24 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/fgiossi/archive/2008/04/23/clausola-top-n.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/fgiossi/comments/commentRss/92359.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/fgiossi/services/trackbacks/92359.aspx</trackback:ping>
        </item>
        <item>
            <title>How to format a value using T-SQL: pad left</title>
            <link>http://blogs.ugidotnet.org/fgiossi/archive/2007/11/15/how-to-format-a-value-using-t-sql.aspx</link>
            <description>SQL server has no built-in format functions. Here is a user defined function which left-pad a varchar value with a variable length string.
CREATE FUNCTION [dbo].[PadString] 

(@Seq varchar(16),
@PadWith char(1),
@PadLength int
) 

RETURNS varchar(16) AS

BEGIN 

declare @curSeq varchar(16)

SELECT @curSeq = ISNULL(REPLICATE(@PadWith, @PadLength - len(ISNULL(@Seq ,0))), '') + @Seq

RETURN @curSeq

END

Testing the function:
SELECT dbo.PadString ('8', '0', 5)

SELECT dbo.PadString ('abc', '*', 12)

SELECT dbo.PadString ('abc', '0', 7)

 
Here are the results:
                 
---------------- 
00008
(1 row(s) affected)
                 
---------------- 
*********abc
(1 row(s) affected)
                 
---------------- 
0000abc
(1 row(s) affected)
---------------------------------------------------------
TAGS: sql server format string pad left&lt;img src="http://blogs.ugidotnet.org/fgiossi/aggbug/89719.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Francesco Giossi</dc:creator>
            <guid>http://blogs.ugidotnet.org/fgiossi/archive/2007/11/15/how-to-format-a-value-using-t-sql.aspx</guid>
            <pubDate>Thu, 15 Nov 2007 09:55:10 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/fgiossi/archive/2007/11/15/how-to-format-a-value-using-t-sql.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/fgiossi/comments/commentRss/89719.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/fgiossi/services/trackbacks/89719.aspx</trackback:ping>
        </item>
    </channel>
</rss>