<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Zero padding fields pulled from SQL Server in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114246#M23526</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sending DBMS specific queries to a server is one on the main uses of SQL Pass-Through. Of course, it is generally much more comfortable to let SAS generate the DBMS specific queries.&amp;nbsp;&amp;nbsp; - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jul 2012 21:42:57 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2012-07-20T21:42:57Z</dc:date>
    <item>
      <title>Zero padding fields pulled from SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114244#M23524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have a SQL Server account but am working with a fellow who does.&amp;nbsp; He's gone for the weekend so I can't have him show me that it really works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;He says that this query works to create a SAS data set of records extracted from a SQL Server table.&amp;nbsp; My question concerns the way he's zero-filling the loan number, a text field.&amp;nbsp; He's using a SQL Server approach to do it. Perhaps my understanding of SQL Pass-Through is incomplete, but I didn't know that you could use RDBMS-specific extensions in a CONNECT TO query like he does.&amp;nbsp; Has anyone else seen this sort of thing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CONNECT TO SQLSVR (DB="bigone" DSN="base" SCHEMA="dbo" UID="&amp;amp;ntuser" PWD="&amp;amp;ntpw");&lt;BR /&gt;CREATE TABLE&amp;nbsp; Tdlq.ASC_loan_curr AS &lt;BR /&gt;SELECT * FROM CONNECTION TO SQLSVR&lt;BR /&gt; (SELECT&lt;/P&gt;&lt;P&gt;&amp;nbsp; CASE WHEN LEN(ma.loan_num) = 6 THEN&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;RIGHT('0000000000' + CONVERT(VARCHAR,ma.client), 11) + RIGHT('0000000000' + CONVERT(VARCHAR,LTRIM(RTRIM(ma.loan_num))), 9)&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ELSE&lt;BR /&gt;&amp;nbsp;&amp;nbsp; RIGHT('0000000000' + CONVERT(VARCHAR,ma.client), 10) + RIGHT('0000000000' + CONVERT(VARCHAR,LTRIM(RTRIM(ma.loan_num))), 10)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; END AS mdss_acct_nbr&lt;BR /&gt;&amp;nbsp; ,ma.next_due_date&lt;/P&gt;&lt;P&gt;&amp;lt;snip&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 21:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114244#M23524</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2012-07-20T21:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Zero padding fields pulled from SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114245#M23525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whoops, never mind.&amp;nbsp; I see on page 5 of the SAS/Access Interfact to Relational Databases that the "The Pass-Through Facility accepts all the extensions to ANSI SQL that are provided by the DBMS."&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 21:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114245#M23525</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2012-07-20T21:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Zero padding fields pulled from SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114246#M23526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sending DBMS specific queries to a server is one on the main uses of SQL Pass-Through. Of course, it is generally much more comfortable to let SAS generate the DBMS specific queries.&amp;nbsp;&amp;nbsp; - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 21:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Zero-padding-fields-pulled-from-SQL-Server/m-p/114246#M23526</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-07-20T21:42:57Z</dc:date>
    </item>
  </channel>
</rss>

