Home All Groups Group Topic Archive Search About

differences between ORACLE and MS SQL

Author
17 Jan 2005 11:26 PM
evagelos
i want to create some queerys in MS-SQL

1)
this queery in ORACLE-SQL works fine , in MS-SQL?
SELECT     code_card, card_date + 31
FROM        card

i searce and find out that i must use "DATEADD ( datepart , number, date )"
but how?

2)
this queery in ORACLE-SQL works fine , in MS-SQL?
SELECT     card_dates, SUM(card_quantity)
FROM         card_transactios
GROUP BY card_dates

i want to return my the sumarize  but if i have 2 card_transactions in
febrary it return to me both of them
what i am doign wrong?

3)
i want to find all card_transaction for month "may"
i must write " LIKE '*/6/2002'  "
but it returns me an error "your entry cannot be converted to a valid
daytime value

4) store procedure is like triggers in ORACLE-SQL?

Author
18 Jan 2005 12:00 AM
Andrew J. Kelly
1.    SELECT     code_card, DATEADD(dd,31,card_date) AS Card_Date
         FROM        card

Please note that if you want to add a month then use mm and 1 instead of dd
and 31.

2.   I don't understand what you are after since there is no
Card_Transaction column in your example.

3.  Use BETWEEN with the first day of the month and the first day of the
next month as the arguments.  See BETWEEN in BooksOnLine.  Or use >= and < .
Also look at these to see how to handle dates properly in SQL Server.

http://www.karaszi.com/SQLServer/info_datetime.asp   Guide to Datetimes
http://www.sqlservercentral.com/columnists/bsyverson/sqldatetime.asp
Datetimes
http://www.murach.com/books/sqls/article.htm    Datetime Searching

4.  I don't know what you are asking here?  A stored procedure is not hte
same as a trigger.  SQL Server has both.

--
Andrew J. Kelly  SQL MVP


Show quote
"evagelos" <evagelos***@hotmail.com> wrote in message
news:uzOKRtO$EHA.2012@TK2MSFTNGP15.phx.gbl...
>i want to create some queerys in MS-SQL
>
> 1)
> this queery in ORACLE-SQL works fine , in MS-SQL?
> SELECT     code_card, card_date + 31
> FROM        card
>
> i searce and find out that i must use "DATEADD ( datepart , number,
> date )"
> but how?
>
> 2)
> this queery in ORACLE-SQL works fine , in MS-SQL?
> SELECT     card_dates, SUM(card_quantity)
> FROM         card_transactios
> GROUP BY card_dates
>
> i want to return my the sumarize  but if i have 2 card_transactions in
> febrary it return to me both of them
> what i am doign wrong?
>
> 3)
> i want to find all card_transaction for month "may"
> i must write " LIKE '*/6/2002'  "
> but it returns me an error "your entry cannot be converted to a valid
> daytime value
>
> 4) store procedure is like triggers in ORACLE-SQL?
>
>
Author
18 Jan 2005 12:09 AM
test
do not cross post!

> this queery in ORACLE-SQL works fine , in MS-SQL?
> SELECT     code_card, card_date + 31
> FROM        card
>
> i searce and find out that i must use "DATEADD ( datepart , number,
date )"
> but how?
> 2)
> this queery in ORACLE-SQL works fine , in MS-SQL?
> SELECT     card_dates, SUM(card_quantity)
> FROM         card_transactios
> GROUP BY card_dates

in ms-sql as the same 1) 2)

> i want to return my the sumarize  but if i have 2 card_transactions in
> febrary it return to me both of them
> what i am doign wrong?
why?

>3)
> i want to find all card_transaction for month "may"
> i must write " LIKE '*/6/2002'  "
> but it returns me an error "your entry cannot be converted to a valid
> daytime value

use datediff
or
between '1/6/2002' and '30/6/2002'
Author
18 Jan 2005 7:57 AM
Dejan Sarka
You might want to check
http://www.microsoft.com/resources/documentation/sql/2000/all/reskit/en-us/part2/c0761.mspx
as well.

--
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com

Show quote
"evagelos" <evagelos***@hotmail.com> wrote in message
news:uzOKRtO$EHA.2012@TK2MSFTNGP15.phx.gbl...
> i want to create some queerys in MS-SQL
>
> 1)
> this queery in ORACLE-SQL works fine , in MS-SQL?
> SELECT     code_card, card_date + 31
> FROM        card
>
> i searce and find out that i must use "DATEADD ( datepart , number,
date )"
> but how?
>
> 2)
> this queery in ORACLE-SQL works fine , in MS-SQL?
> SELECT     card_dates, SUM(card_quantity)
> FROM         card_transactios
> GROUP BY card_dates
>
> i want to return my the sumarize  but if i have 2 card_transactions in
> febrary it return to me both of them
> what i am doign wrong?
>
> 3)
> i want to find all card_transaction for month "may"
> i must write " LIKE '*/6/2002'  "
> but it returns me an error "your entry cannot be converted to a valid
> daytime value
>
> 4) store procedure is like triggers in ORACLE-SQL?
>
>

AddThis Social Bookmark Button