How to convert MS SQL's 'smalldatetime' to PB 'date' in DW?

Suppose I have a Powerbuilder datawindow with a column of
type 'date'. I also have a MS SQL 7 database table
with a column of type 'date' where 'date' is a
MS SQL's user defined type which maps to MS SQL's
'smalldatetime'. Now I retrieve the datawindow.
On Windows XP Professional in the datawindow I have
a beautiful date, let's say '1-2-03' but on
Windows 95 I have garbage: '??-??-1241' or similar.

Here is my question: how to convert the MS SQL's
'smalldatetime' value to the PB 'date' type
'on-the-fly', so that it displays everywhere properly?


somehow want
to convert
0
azaleski
9/8/2003 3:00:24 PM
sybase.powerbuilder.general 62418 articles. 19 followers. Follow

3 Replies
1133 Views

Similar Articles

[PageSpeed] 34
Get it on Google Play
Get it on Apple App Store

As you may now, MS SQL and Sybase ASE have the same root.

With ASE, i use powerbuilder type 'datetime' and everything is fine on any OS.


On 8 Sep 2003 08:00:24 -0700,
 in sybase.public.powerbuilder.general
 <azaleski@anzasoft.pl> wrote: 
>Suppose I have a Powerbuilder datawindow with a column of
>type 'date'. I also have a MS SQL 7 database table
>with a column of type 'date' where 'date' is a
>MS SQL's user defined type which maps to MS SQL's
>'smalldatetime'. Now I retrieve the datawindow.
>On Windows XP Professional in the datawindow I have
>a beautiful date, let's say '1-2-03' but on
>Windows 95 I have garbage: '??-??-1241' or similar.
>
>Here is my question: how to convert the MS SQL's
>'smalldatetime' value to the PB 'date' type
>'on-the-fly', so that it displays everywhere properly?
>
>
>somehow want
>to convert

Olivier Citeau from Paris, France
0
Olivier
9/8/2003 3:18:47 PM
My problem with date field and MS SQL 7
was due to my mistake - I used PB 6.5
'pbmss60.dll' MS SQL native driver instead
of the PB 6.5.1 version (dated 14-5-1999)

BTW, I have here a great example of what PB
6.5.1 can do: a large application, literally
thousands of objects and one code base connects
WITHOUT a single change to ASA 8 or MS SQL 7.
The main issue to fix was the famous date
data type which you won't find in MS SQL or
Oracle (somebody tell me why?!?) I did this
by creating a MS SQL user data type 'date'
and mapping it to the 'smalldatetime'.
Recreating SQL Anywhere database on MS SQL was
easy (SQL Anywhere 'unload' did 95% of the job
then there were a few changes to re-create foreign
keys where MS SQL and SQL Any syntaxes differ).

I use native driver to connect to the MS SQL and
ODBC to connect to the ASA.

Another thing that needed a fix were the double quotes
- MS SQL has problem with them - can't say why it looks
like it thinks that a double quote is a single quote -
maybe for M$ it does not make a difference:-)
Fix was to put code in constructor event for the datawindow
and datastore ancestor user objects - quick fix.
SetSQLSelect also did not work - I had to override it
in the datawindow and datastore ancestor user objects
with Modify("DataWindow.Table.Select='" + <my_sql> + "'").

All above did the job and I have tested it on Win XP,
NT 4 and 95.

BTW II: if you want to roll-out an application that
won't need any changes at all - use datetime instead
of date and don't use double quotes. Oracle also
seems to be lacking 'date' data type - I would loose any
bet on it _no_date_data_type_ on major databases???
Unbelievable!
0
azaleski
9/8/2003 11:02:50 PM
<azaleski@anzasoft.pl> wrote in message
news:3f5d0af8.44a2.846930886@sybase.com...

> Another thing that needed a fix were the double quotes
> - MS SQL has problem with them - can't say why it looks
> like it thinks that a double quote is a single quote -
> maybe for M$ it does not make a difference:-)

   Try SET QUOTED_IDENTIFIER ON

Dmitri.

0
Dmitri
9/9/2003 6:23:53 AM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

'or' or 'union'
Hello I was just wondering, in general what is better to use, an 'or' clause in a select or a 'union' to join two selects together. Do both statements create work tables? Many thanks Alex I think OR will be better than union. because suppose u have 3 tables and using OR u can join table a and table b and table c so each table will have only one read. but using union you will join table a and table b and in another query of union u will use table (a or b) and table c so ur one read is more in union . Ramdas Alex Cheung wrote: > Hello > >...

'IN' Clause or 'OR'
Hello, [1]: select * from TABLEA where COL1 IN('value1','value2''valu3'....) [2]:select * from TABLEA where COL1 = 'value1' OR COL1= 'value2' OR COL1='valu3'. TABLEA is a huge table and it has non-clustered index on COL1. Among the above 2 queries, which query will give me the better performance or fast response and WHY? What is the difference between 'IN' and 'OR' clauses as for as Sybase Optimization is concerned. Which is the better one to be used on huge tables. Thanks. Mac An IN list is treated ...

'b'..'a'
Hello. I'm using defferent 5.6.0's for Win32. I wonder wheter following behaviour is intentional or not: d:\>perl -e "print 'b'..'c'" bc d:\>perl -e "print 'b'..'a'" bcdefghijklmnopqrstuvwxyz I expected empty list in latter case, like in perl -e "print 'bb'..'a'" <!ENTITY Vadim REALLIFE "Vadim V.Konovalov, St.Petersburg, Russia"> &Vadim; On Wed, Sep 20, 2000 at 03:14:41PM +0400, Konovalov, Vadim wrote: > Hello. > > I'm using defferent 5.6.0'...

SQL replace '-' by ''
Hi all i have a question regarding sql, i want to replace some characters...   any knows simply how to do this?   I want to replace "999-25000-69" by "9992500069"   grtzDon't forget to click "Mark as Answer" on the post that helped you. SELECT Replace('999-25000-69','-', '') or SELECT Replace(col1,'-', '') as col1 FROM yourTableLimno...

'Value' should be between 'minimum' and 'maximum'.
I'm attempting to invoke with parameters:  Dim thing2 As New mydelsubPBStep(AddressOf pbStep) Me.Invoke(thing2, "setMax", dt.Rows.Count)      <---- this is where the error occurs   the delegate looks like this: Private Delegate Sub mydelsubPBStep(ByVal mode As String, ByVal value As Integer)   the function it's calling looks like this:Private Sub pbStep(ByVal mode As String, ByVal value As Integer) Select Case mode.ToLower Case "clear" ProgressBar1.Value = 0 Case "step" ProgressBar1.PerformStep() L...

EXEC sp_msforeachtable 'sp_spaceused ''?'''
What does the following SQL code mean?  EXEC sp_msforeachtable 'sp_spaceused ''?'''Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". JohanNL:sp_msforeachtable This is the name of the SP that resides in the master database.  This SP executes one or more commands for a table. JohanNL:sp_spaceused This is the command that you want to run for each of the tables residing in your current database.  As you might have understood so far, that this is again a...

'To', 'CC', & 'BCC'
Name: Dick Tracy Email: philipdottracyatoptusnetdotcomdotau Product: Thunderbird Summary: 'To', 'CC', & 'BCC' Comments: I have just started using Thunderbird and while I find it quite excellent- I suggest having a button to add addressees to 'BCC' as well. Currently each 'BCC' addressee has to be selected manually. I send e-mail to quite a number of people at a time and I do not wish to readily spread others addresses easily. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0....

'DateRange' cannot be converted to type 'Date'.
My machine does not run the code with "Data" including the Starts Kit and always occurs such an error message: 'DateRange' cannot be converted to type 'Date'. As a example, I try to run a validation example: <asp:RangeValidator id="DateRange" runat="server" ControlToValidate="OurDateBox" Type="Date" MinimumValue="7/1/2002" MaximumValue="12/31/2002" ErrorMessage="Show isn't offered on that date."></asp:RangeValidator> The system does not accept the fo...

Web resources about - How to convert MS SQL's 'smalldatetime' to PB 'date' in DW? - sybase.powerbuilder.general

Resources last updated: 12/19/2015 3:33:05 AM