Showing posts with label requirement. Show all posts
Showing posts with label requirement. Show all posts

Thursday, March 22, 2012

Converting a date from one timezone to another timezone

Hi,
I have a requirement for a function which would convert a given date with a present timezone to a new timezone.

For eg : the function would be called lets say TZ

then I can issue the following select statement to get the new timezone

select getdate(), TZ(getdate(), PST, EST)

where PST is the current timezone and EST is the new timezone.

I know that ORACLE has a built in function to do this. Am just wondering if theres some function that I can use to accomplish the task.

Thanks
-soumilyou can write your own function using info from this site (http://wwp.greenwichmeantime.com/info/timezone.htm).|||This is a real pain-in-the-butt to do, not just because of all the time zones, but because even within a time-zone some areas may use Daylight Savings Time, and some may not.

I had to deal with this when I designed an EDI tracking application. In the end we decided it was best to always output the data in GMT and then let the webpage translate it to whatever local time the page was being viewed in. For incoming data, I required all events to include a time stamp from their point of origin, and then I added a local time stamp. By comparing the two values we were able to synchronize events across time-zones without even caring what zone they came from, and it accounted for discrepancies in system-clock times as well.

I hope you can use some work-around like this, or find someone who has already written the procedure/function for you.|||there is one already written by tara check it out:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=28712
harsh.

Wednesday, March 7, 2012

convert rtf to plain text

Hi All,
can anybody please tell me how to use below sql function.I have a
requirement to convert rtf formatted string as plain text from sql
table.I found below sql function in google search. but I dont no how
to use this.what is 'RICHTEXT.RichtextCtrl' ?
CREATE function dbo.RTF2Text(@.in varchar(8000)) RETURNS varchar(8000)
AS
BEGIN
DECLARE @.object int
DECLARE @.hr int
DECLARE @.out varchar(8000)
-- Create an object that points to the S
-- QL Server
EXEC @.hr = sp_OACreate 'RICHTEXT.RichtextCtrl', @.object OUT
EXEC @.hr = sp_OASetProperty @.object, 'TextRTF', @.in
EXEC @.hr = sp_OAGetProperty @.object, 'Text', @.out OUT
EXEC @.hr = sp_OADestroy @.object
RETURN @.out
END
GO
All i need is to retrive this rtf formatted string as plain text.
Any help is appreciated!
ThanksThat is a COM object of some kind that needs to be registered on the server.
I was able to call the object in VBScript, but it sounds like something that
may need to be installed with Word. My guess is that you will be better off
doing this conversion from an application that understands RTF -> text
conversion rather after it retrieves the SQL data, than to call this
external process from within SQL Server...
A
"munnyAnu" <dkanumolu@.gmail.com> wrote in message
news:1188320430.440778.81540@.g4g2000hsf.googlegroups.com...
> Hi All,
> can anybody please tell me how to use below sql function.I have a
> requirement to convert rtf formatted string as plain text from sql
> table.I found below sql function in google search. but I dont no how
> to use this.what is 'RICHTEXT.RichtextCtrl' ?
>
> CREATE function dbo.RTF2Text(@.in varchar(8000)) RETURNS varchar(8000)
> AS
> BEGIN
> DECLARE @.object int
> DECLARE @.hr int
> DECLARE @.out varchar(8000)
> -- Create an object that points to the S
> -- QL Server
> EXEC @.hr = sp_OACreate 'RICHTEXT.RichtextCtrl', @.object OUT
> EXEC @.hr = sp_OASetProperty @.object, 'TextRTF', @.in
> EXEC @.hr = sp_OAGetProperty @.object, 'Text', @.out OUT
> EXEC @.hr = sp_OADestroy @.object
> RETURN @.out
> END
> GO
>
> All i need is to retrive this rtf formatted string as plain text.
> Any help is appreciated!
>
> Thanks
>

Saturday, February 25, 2012

Convert Oracle "connect by level < 10" into MS SQL server 2005

I want to convert oracle "SELECT LEVEL R FROM CONNECT BY LEVEL <=10" my bottom requirement is get 1 to 10 as a dynamic table inside a query.

Ex: Select id, name, R from names N, (1,2,3,4,5,6,7,8,9,10) R WHERE id < 1000

If any one know something regarding this please reply me.

Thx,

Buddhika

We have recursion in SQL Server, but are you asking about the CONNECT BY LEVEL auto-numbering use?

Buck Woody

|||

If you're looking for the hierarchical query in SQL Server, you can check here:

http://www.databasejournal.com/features/oracle/article.php/3552521

Buck Woody

|||MSDN says there is no SQL equivalent to CONNECT BY:
http://www.microsoft.com/technet/prodtechnol/sql/70/proddocs/admincmp/75517c11.mspx?mfr=true

It suggests using a stored procedure instead.|||That reference is for the SQL 7 docs (almost 10 years old). IIRC Connect by with level is recursion with an automatic recursion depth checker/autonumber. Start with Bucks link.

Convert Oracle "connect by level < 10" into MS SQL server 2005

I want to convert oracle "SELECT LEVEL R FROM CONNECT BY LEVEL <=10" my bottom requirement is get 1 to 10 as a dynamic table inside a query.

Ex: Select id, name, R from names N, (1,2,3,4,5,6,7,8,9,10) R WHERE id < 1000

If any one know something regarding this please reply me.

Thx,

Buddhika

We have recursion in SQL Server, but are you asking about the CONNECT BY LEVEL auto-numbering use?

Buck Woody

|||

If you're looking for the hierarchical query in SQL Server, you can check here:

http://www.databasejournal.com/features/oracle/article.php/3552521

Buck Woody

|||MSDN says there is no SQL equivalent to CONNECT BY:
http://www.microsoft.com/technet/prodtechnol/sql/70/proddocs/admincmp/75517c11.mspx?mfr=true

It suggests using a stored procedure instead.|||That reference is for the SQL 7 docs (almost 10 years old). IIRC Connect by with level is recursion with an automatic recursion depth checker/autonumber. Start with Bucks link.

Convert Oracle "connect by level < 10" into MS SQL server 2005

I want to convert oracle "SELECT LEVEL R FROM CONNECT BY LEVEL <=10" my bottom requirement is get 1 to 10 as a dynamic table inside a query.

Ex: Select id, name, R from names N, (1,2,3,4,5,6,7,8,9,10) R WHERE id < 1000

If any one know something regarding this please reply me.

Thx,

Buddhika

We have recursion in SQL Server, but are you asking about the CONNECT BY LEVEL auto-numbering use?

Buck Woody

|||

If you're looking for the hierarchical query in SQL Server, you can check here:

http://www.databasejournal.com/features/oracle/article.php/3552521

Buck Woody

|||MSDN says there is no SQL equivalent to CONNECT BY:
http://www.microsoft.com/technet/prodtechnol/sql/70/proddocs/admincmp/75517c11.mspx?mfr=true

It suggests using a stored procedure instead.
|||That reference is for the SQL 7 docs (almost 10 years old). IIRC Connect by with level is recursion with an automatic recursion depth checker/autonumber. Start with Bucks link.