Tema: Re: help : SQL CAST funkcija
Autorius: Raimis
Data: 2010-01-28 15:07:27
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18876">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>pabandyk taip:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>cast( cast([code] as decimal(20,0))&nbsp;as 
varchar(20))</FONT></DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px" 
dir=ltr>
  <DIV>"Pilas" &lt;<A 
  href="mailto:fipaul1NEREIKIANUTRINTI@yahoo.com">fipaul1NEREIKIANUTRINTI@yahoo.com</A>&gt; 
  wrote in message <A 
  href="news:hjs0d0$hhs$1@trimpas.omnitel.net">news:hjs0d0$hhs$1@trimpas.omnitel.net</A>...</DIV>
  <DIV><FONT size=2 face=Arial>sveiki,</FONT></DIV>
  <DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
  <DIV><FONT size=2 face=Arial>turiu excel lapa ir kurio reikai suimportuoti 
  kodus i SQL lentele &nbsp;kaip charakterius.</FONT></DIV>
  <DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
  <DIV><FONT size=2 face=Arial>pasirasiau su&nbsp;&nbsp; CAST&nbsp;&nbsp; 
  :</FONT></DIV>
  <DIV><FONT size=2 
face=Arial>-------------------------------------</FONT></DIV>
  <DIV>
  <P><FONT size=2 face=Arial>insert INTO [Baze].[dbo].[list]</FONT></P>
  <P><FONT size=2 face=Arial>SELECT cast( [code] as char(20))</FONT></P>
  <P><FONT size=2 face=Arial>FROM 
  OPENROWSET('Microsoft.Jet.OLEDB.4.0',</FONT></P>
  <P><FONT size=2 face=Arial>'Excel 
  8.0;Database=C:\SQL\baze\list.xls',</FONT></P>
  <P><FONT size=2 face=Arial>'SELECT * FROM [Sheet1$]')</FONT></P>
  <P><FONT size=2 face=Arial>----------------------------------------</FONT></P>
  <P><FONT size=2 face=Arial>bet dalis kodu nesusiimportuoja teisingai&nbsp;: 
  kodai&nbsp;6 zenklu tvarkingai gaunasi : 123456,&nbsp; o visi 7-zenkliai&nbsp; 
  gaunasi kaip skaicius&nbsp;: 1.2345e+006</FONT></P></DIV>
  <DIV><FONT size=2><FONT face=Arial>jei bandau trumpinti char - tada 
  netelpa&nbsp; meta klaida " </FONT><FONT size=1><FONT size=2 
  face=Arial>Arithmetic overflow error for type varchar, value = 
  5266700.000000"&nbsp;&nbsp; cia turetu buti kodas 5266700 - 
  7zenklis.</FONT></FONT></FONT></DIV>
  <DIV><FONT size=2><FONT size=1><FONT size=2 
  face=Arial></FONT></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT size=2 face=Arial>cia mano SQL pradmenys, todel labai nemuskit. 
  </FONT></DIV>
  <DIV><FONT size=2><FONT size=1><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
  <DIV><FONT size=2 face=Arial></FONT></FONT></FONT>
  <P>&nbsp;</P>
  <P><FONT size=2 face=Arial></FONT>&nbsp;</P>
  <P><FONT size=2 face=Arial></FONT>&nbsp;</P>
  <P><FONT size=2 face=Arial></FONT>&nbsp;</P></DIV></BLOCKQUOTE></BODY></HTML>