Showing posts with label below. Show all posts
Showing posts with label below. Show all posts

Friday, March 30, 2012

Launch a URL from TSQL code [URGENT]

Hi Folks,

I am a SQL Server DBA but I am new to real TSQL programming. I have a question as explained below and any help (soon) will be appreciated.

I want to invoke a web page from within a TSQL code:
1) Is it possible to do this?
2) If yes, how?
3) Can I call a web page from command prompt?

Please help me on this - this is quite urgent for me.

Thanks a lot!

Astha1) I was able to invoke the webpage by typing this at the command prompt

c:\Program Files\Internet Explorer\iexplore.exe" http://www.google.com

however somehow the same not working when i tried it using xp_cmdshell ...

SQL gurus ... any ideas why ??|||Thanks Enigma :)

This really helped and was fine with what I needed. However, when running this from xp_cmdshell - I guess you should use with CMD .

Thanks again.

Astha

Friday, March 23, 2012

Last_day and First_Day of the month

Hi,

Can I use Last_day(table_date) and first day? I have the query below and it is not working. If not is there any suggestions? I error is pointing at the "First_day".

SQL> SELECT to_char(to_date(first_day(s.key_date),'YYYYMMDD'), 'MM/DD/YYYY') START_DATE,
2 to_char(to_date(last_day(s.key_date),'YYYYMMDD'),' MM/DD/YYYY') END_DATE
3 FROM schedule s;
SELECT to_char(to_date(first_day(s.key_date),'YYYYMMDD'), 'MM/DD/YYYY') START_DATE,
*
ERROR at line 1:
ORA-00904: invalid column name

Thanks a lotThere is an Oracle function called LAST_DAY that returns last day of month for given date, but not FIRST_DAY. For first day of month use TRUNC(s.key_date,'MM')|||What about formatting it like this ('MM/DD/YYYY'), remeber the actual table date is in 8 bytes varchar2.

Thanks|||My first reponse to that is: "why?" Why would anyone store dates as VARCHAR2 and not as DATE? Does not compute...

Anyway, you must convert the VARCHAR2 to a DATE before applying any other functions that work with dates:

LAST_DAY( TO_DATE(s.key_date,'MM/DD/YYYY') )

TRUNC( TO_DATE(s.key_date,'MM/DD/YYYY'), 'MM' )