Unix Technical Forum

Newbie question INSERT and Select Into

This is a discussion on Newbie question INSERT and Select Into within the Sybase forums, part of the Database Server Software category; --> Hi here are some other newbie question about translating SQLserver intructions in ASE. If anyone could point out the ...


Go Back   Unix Technical Forum > Database Server Software > Sybase

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 06:08 PM
pamelafluente@libero.it
 
Posts: n/a
Default Newbie question INSERT and Select Into

Hi here are some other newbie question about translating SQLserver
intructions in ASE.
If anyone could point out the necessary correction I will be grateful.
Thanks

-Pamela


These one is giving error:

INSERT INTO DataSource1 VALUES ('04/07/1996','Vins et alcools
Chevalier','16/07/1996','51100','Reims','59 rue de
l''Abbaye','France',5,32.38,'VINET',3,'01/08/1996',NULL)


where DataSource1 has been created as:

CREATE TABLE DataSource1 (
OrderDate date,
ShipName text,
ShippedDate date,
ShipPostalCode text,
ShipCity text,
ShipAddress text,
ShipCountry text,
EmployeeID int,
Freight decimal,
CustomerID text,
ShipVia int,
RequiredDate date,
ShipRegion text)



Also I get error with the following:



----------------------------------------------------
SELECT
DataSource1.RequiredDate AS "RequiredDate",
DataSource1.ShipPostalCode AS "ShipPostalCode",
DataSource1.ShipCountry AS "ShipCountry",
DataSource1.ShipCity AS "ShipCity",
DataSource1.ShipName AS "ShipName",
DataSource1.ShippedDate AS "ShippedDate",
DataSource1.ShipAddress AS "ShipAddress",
DataSource1.OrderDate AS "OrderDate",
DataSource1.ShipVia AS "ShipVia",
DataSource1.ShipRegion AS "ShipRegion",
INTO NEWTABLE FROM
DataSource1,
DataSource2
WHERE
DataSource1.OrderDate = DataSource2.OrderDate


QueryInterface for interface IErrorInfo failed.


--------------------------------------------------------

thank you

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 06:08 PM
Michael Peppler
 
Posts: n/a
Default Re: Newbie question INSERT and Select Into

On Mon, 31 Oct 2005 08:51:43 -0800, pamelafluente wrote:

> Hi here are some other newbie question about translating SQLserver
> intructions in ASE.
> If anyone could point out the necessary correction I will be grateful.
> Thanks
>
> -Pamela
>
>
> These one is giving error:
>
> INSERT INTO DataSource1 VALUES ('04/07/1996','Vins et alcools
> Chevalier','16/07/1996','51100','Reims','59 rue de
> l''Abbaye','France',5,32.38,'VINET',3,'01/08/1996',NULL)
>
>
> where DataSource1 has been created as:
>
> CREATE TABLE DataSource1 (
> OrderDate date,
> ShipName text,
> ShippedDate date,
> ShipPostalCode text,


etc...

Ouch!

Do you really want to have "text" columns for all those items?

That's something that is going to cause serious problems later on, I think
- too much space used, and just plain hard to work with in stored procs
and similar.

> Also I get error with the following:
>
>
>
> ---------------------------------------------------- SELECT
> DataSource1.RequiredDate AS "RequiredDate",
> DataSource1.ShipPostalCode AS "ShipPostalCode",
> DataSource1.ShipCountry AS "ShipCountry", DataSource1.ShipCity
> AS "ShipCity",
> DataSource1.ShipName AS "ShipName",
> DataSource1.ShippedDate AS "ShippedDate",
> DataSource1.ShipAddress AS "ShipAddress", DataSource1.OrderDate
> AS "OrderDate", DataSource1.ShipVia AS "ShipVia",
> DataSource1.ShipRegion AS "ShipRegion",
> INTO NEWTABLE FROM
> DataSource1,
> DataSource2
> WHERE
> DataSource1.OrderDate = DataSource2.OrderDate
>
>
> QueryInterface for interface IErrorInfo failed.


That's not a Sybase error that I recognize. What tool are you using to
execute the query?

Michael
--
Michael Peppler [TeamSybase] mpeppler@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 06:08 PM
pamelafluente@libero.it
 
Posts: n/a
Default Re: Newbie question INSERT and Select Into

Hi Michael,

I am porting data from SQL sever to ASE through a .NET application.
I have used text just * by guess * because I didn't know the exact
correspondence between the .NET type and ASE type.

I would need a kind of correspondence map for these two.
I have seen that ASE has the following:

datetime, Provider type:135, Nullable
time, Provider type:134, Nullable
date, Provider type:133, Nullable
numeric, Provider type:131, Nullable
decimal, Provider type:131, Nullable
unichar, Provider type:130, Nullable
unitext, Provider type:130, Nullable
univarchar, Provider type:130, Nullable
varchar, Provider type:129, Nullable
char, Provider type:129, Nullable
text, Provider type:129, Nullable
nvarchar, Provider type:129, Nullable
nchar, Provider type:129, Nullable
sysname, Provider type:129, Nullable
timestamp, Provider type:128, Nullable
binary, Provider type:128, Nullable
image, Provider type:128, Nullable
varbinary, Provider type:128, Nullable
unsigned bigint, Provider type:21, Nullable
bigint, Provider type:20, Nullable
unsigned int, Provider type:19, Nullable
unsigned smallint, Provider type:18, Nullable
tinyint, Provider type:17, Nullable
bit, Provider type:11
smalldatetime, Provider type:7, Nullable
smallmoney, Provider type:6, Nullable
money, Provider type:6, Nullable
float, Provider type:5, Nullable
real, Provider type:4, Nullable
int, Provider type:3, Nullable
smallint, Provider type:2, Nullable


While I have the following:


Boolean
Byte
Decimal
Single
Double
Int16
Int32
Int64
--------
DateTime
--------
String
Char

Byte () (vector of bytes)

SByte
TimeSpan
UInt16
UInt32
UInt64

Would I ask too much if you could indicate near to each of the above
types
the best ASE correspondent (possibly with field size), for my
translation.

Thank you very much
-Pamela

PS
The query was sent to the Oledb client by the .net application.
But it should not be the issue since every other query or command works
fine.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 06:08 PM
Michael Peppler
 
Posts: n/a
Default Re: Newbie question INSERT and Select Into

On Mon, 31 Oct 2005 09:16:38 -0800, pamelafluente wrote:

> Hi Michael,
>
> I am porting data from SQL sever to ASE through a .NET application. I have
> used text just * by guess * because I didn't know the exact correspondence
> between the .NET type and ASE type.
>
> I would need a kind of correspondence map for these two. I have seen that
> ASE has the following:
>
> datetime, Provider type:135, Nullable time, Provider type:134, Nullable
> date, Provider type:133, Nullable
> numeric, Provider type:131, Nullable
> decimal, Provider type:131, Nullable
> unichar, Provider type:130, Nullable
> unitext, Provider type:130, Nullable
> univarchar, Provider type:130, Nullable varchar, Provider type:129,
> Nullable
> char, Provider type:129, Nullable
> text, Provider type:129, Nullable
> nvarchar, Provider type:129, Nullable nchar, Provider type:129, Nullable
> sysname, Provider type:129, Nullable
> timestamp, Provider type:128, Nullable binary, Provider type:128, Nullable
> image, Provider type:128, Nullable
> varbinary, Provider type:128, Nullable unsigned bigint, Provider type:21,
> Nullable bigint, Provider type:20, Nullable
> unsigned int, Provider type:19, Nullable unsigned smallint, Provider
> type:18, Nullable tinyint, Provider type:17, Nullable
> bit, Provider type:11
> smalldatetime, Provider type:7, Nullable smallmoney, Provider type:6,
> Nullable money, Provider type:6, Nullable
> float, Provider type:5, Nullable
> real, Provider type:4, Nullable
> int, Provider type:3, Nullable
> smallint, Provider type:2, Nullable
>
>
> While I have the following:
>
>
> Boolean


bit

> Byte


binary(size)

> Decimal


decimal(size, precision)

> Single
> Double


float

> Int16

smallint

> Int32

int

> Int64


decimal(size, 0)
bigint (ASE 15 only).

> --------
> DateTime


datetime

> --------
> String
> Char


varchar, size up to 16k depending on the page size of your server. For the
columns defined in your sample varchar() will work just fine (name and
addresses and the like)
>
> Byte () (vector of bytes)


varbinary(size) (up to 16k, again depending on page size)

>
> SByte


Don't know what that is...

> TimeSpan


What is the unit used here?
Or you can store a begin and end date in datetime, and compute the
difference via datediff() as necessary.

> UInt16
> UInt32
> UInt64


Unsigned smallint, int, bigint, available only in ASE 15.


Michael
--
Michael Peppler [TeamSybase] mpeppler@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 06:08 PM
pamelafluente@libero.it
 
Posts: n/a
Default Re: Newbie question INSERT and Select Into

THANKS!!!!!!!!!!!!!!!

This is invaluable to me. You have saved me a lot of time.

About Timespan I have to find out. I have always had doubts about it.
>From a programming

point of view it represents a time interval, but I have to find out
about the internal representation.
Perhaps something like Double will just do it.

It is necessary to do some experiments to see if ASE accept this kind
of values.

-Pamela

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:06 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com