Not a Julian Date. How CVTDATE works with MS SQL

by Marie 14. June 2012 18:15

I was having a problem converting what I thought to be a Julian Date coming from iSeries into SQL Server.  I wasn't able to use the CVTDATE funciton that works wonders in iSeries because I was building an SSIS package to import the data into sql server.  I was getting result like 5024-07-26 for my date field.  So with a little research, I came accross this forum that explains how the CVTDATE works and how to convert these fields in MS SQL.  Enjoy!

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=108666

Not a Julian Date.  How CVTDATE works with MS SQL

When SQL server is installed into an AS400 and a data mirror is replicated what is the best way to do the date conversion in SQL Server.

Currently SQL Server pulls the date as (CYMD)

what does the '1' in 1080813 indicate ?

declare @d varchar(7) select @d = '1080813' select convert(datetime, case when left(@d, 1) = '1' then '20' + right(@d, 6) else '19' + right(@d, 6) end, 112)

It says Centry (21st) They Year, Month , Date (CYMD)


The Money:

CASE WHEN LEN(Field) = 7 THEN CAST('20' + RIGHT(Field, 6) AS DATETIME) ELSE CAST('19' + RIGHT(Field, 6) AS DATETIME) END

 

Also check out Converting from a Julian Date.  Scalar Function to use in MS SQL

Tags:

iSeries

Not Enough Cheat Sheets At Your Fingertips!

by Marie 13. June 2012 17:18

Now Where did you put those cheat sheets?  Cheat sheets are always a handy tool to have around when you need to code something fast or just as a refresher to some code you haven't used in a while.

Top Design Mag has compliled a List of Cheat Sheets to use when devloping in HTML, CSS, JavaScript, ASP.NET, PHP and MySQL.

Check them out to save you some of your precious time!  Have you come Accross any Developer Cheat Sheets?  I would love to see them.  Share them below.

Tags: , , , , , , ,

Cheat Sheets

How do I write a query that outputs the row number as a column?

by Marie 12. June 2012 17:10

http://stackoverflow.com/questions/438610/how-do-i-write-a-query-that-outputs-the-row-number-as-a-column


This is how you output a row number in iSeries in a Select statement:

SELECT ROW_NUMBER() OVER (ORDER BY beatle_name ASC) AS ROWID, * FROM beatles

Tags:

iSeries

JQuery Examples

by Marie 2. June 2012 02:11

Here is a list of jQuery Examples, plugins and Tutorials that I have found.  Some of them you may have already found. 

 

50 Amazing jQuery examples

20 Useful jQuery Plugins

100 Popular jQuery Plugins

jQuery Tutorials

 

Tags: ,

jQuery | Misc

JSFIDDLE

by Marie 2. June 2012 02:04
http://jsfiddle.net/TWZqP/1/embedded/result/

Tags:

Online Editors