Tuesday, February 14, 2012

differences between ORACLE and MS SQL

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?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/col...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
"evagelos" <evagelos_21@.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?
>|||You might want to check
http://www.microsoft.com/resources/...r />
0761.mspx
as well.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"evagelos" <evagelos_21@.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?
>

No comments:

Post a Comment