Inserting Non-unix Timestamp

Sep 6, 2013

Is it possible to insert a timestamp into a db if it's in this format?

Sep-04-13 07:13

I don't need it to stay in this format. I just need to know if I can cast it as a unix timestamp somehow & insert or if the manipulation to the datetime fomrat has to happen before inserting.

View 3 Replies


ADVERTISEMENT

Convert Unix Timestamp To UTC

Sep 12, 2007



Hi

Is there a way in T-SQL (Server 2005) to convert unix timestamp to UTC

So want to do this:
1189481763.61 -> Tue, 11 Sep 2007 03:36:03 UTC(or any UTC format)


Thanks

View 3 Replies View Related

Unix Timestamp To DATETIME Datatype

Jan 16, 2004

Hi all,

I have moved a mysql table to SQL Server and the table had an int datatype storing the value of the Unix timestamp. I want to convert this datatype into a DATETIME type in SQL Server.

Any ideas how I could do it?

Thanks in advance.

View 8 Replies View Related

SQL Server 2012 :: UNIX Timestamp In Second

Oct 27, 2014

I've got a question about the UNIX timestamp solutions, I am using this one:

select convert(datetime, switchoffset(convert(datetimeoffset, dateadd(second, start_date, '19700101')), datename(TzOffset, sysdatetimeoffset())))
from x

This works great for today (wintertime), but when I query the past, say last week, it will still hold the current offset of my server GMT+1, where it was GMT+2.

Is there a way to get always the right date/time from a sql-query?

View 0 Replies View Related

Unix, Windows For Unix, And Direct Read Of .mdf File This Is A True Story

Sep 13, 2007

First, let me start by saying I know the answer to this, but due to politics any answer I give will be viewed with some disdain and disbelief.

A Unix/Network [rtdpmin one our sister agencies is trying to solve a problem that really does not need to be solved, but ....

The sister agency uses Information Builder's WebFocus on Unix. When they try to read my data warehouse in SQL Server 2000 it times out on them (on their end and they claim they cannot fix it) (This is using the supplied WebFocus ODBC/JDBC driver for SQL Server). This has lead to accusations of us not letting them read the data.

After much gnashing of teeth over "if you do data and data analysis for a living, why do I have to show you how to set-up an ODBC connection" we have shown them how to connect to the data, read it, and transfer it using MS-ACCESS, EXCEL, and more importantly SPSS. This is not good enough because they cannot figure out how to put it into WebFocus.

Their network person has come-up with the brilliant idea of reading the .mdf directly by installing Windows for Unix on the Unix side and then just pointing to the .mdf file and "reading it ".

Unless I have missed something somwhere (I will admit possible), I know you need a driver to read MS-SQL and that driver in every example I have seen could care less about the physical location of the .mdf file. It wants to know what database, what server (ip or name) and what security/login to use.

Could someone give me a more "technical answer" or even Microsoft's party line so I do not have this person mucking around with my production server trying to acomplish the impossible.

View 5 Replies View Related

Error While Converting Oracle Timestamp To Sql Server Timestamp (datetime) - Invalid Date Format

Jun 19, 2007

I am populating oracle source in Sql Server Destination. after few rows it fails it displays this error:

[OLE DB Destination [16]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description:
"Invalid date format".



I used this script component using the following code in between the adapters, However after 9,500 rows it failed again giving the same above error:








To convert Oracle timestamp to Sql Server timestamp

If Row.CALCULATEDETADATECUST_IsNull = False Then

If IsDate(DateSerial(Row.CALCULATEDETADATECUST.Year, Row.CALCULATEDETADATECUST.Month, Row.CALCULATEDETADATECUST.Day)) Then

dt = Row.CALCULATEDETADATECUST

Row.CALCULATEDETADATECUSTD = dt

End If

End If



I don't know if my code is right . Please inform, how i can achieve this.

View 6 Replies View Related

Transact SQL :: Query To Display Avg Values For Each Timestamp And Count Of Timestamp

Jun 23, 2015

date        time         s-sitename TimeTaken(Seconds)
6/8/2015 10:56:26 TestSite 100
6/8/2015 10:56:26 TestSite 500
6/8/2015 10:56:26 TestSite 800
6/9/2015 11:56:26 TestSite 700
6/9/2015 11:56:26 TestSite 200
6/12/2015 12:56:26 TestSite 700

I have a table with above values, I am looking for a sql query to find AvgTimeTaken at different time stamps and total count of each time stamp

Output
date        time         s-sitename TimeTaken(Seconds) Count_of_Request
6/8/2015 10:56:26 TestSite 1400                  3
6/9/2015 11:56:26 TestSite 900                   2
6/12/2015 12:56:26 TestSite 700                   1

View 5 Replies View Related

Get Row Timestamp With No Timestamp Column

Jul 10, 2007

For starters, please feel free to move this if it is in the wrong forum.



The issue I have is this. I have been asked to delete all information from a table that was inserted before May 12 this year. The issue is that when the DB was created, whoever designedd it neglected to add a timestamp column for the user data table (the one I need to purge). Does SQL, by default, happen to store insert times? Would it be something that might hide ina log file somewhere?

View 4 Replies View Related

SQL And UNIX

Jul 23, 2005

Hi,Can MS SQL work under UNIX operating system, and can it be installed on IBMAS 400.Thanks very much,Mark

View 2 Replies View Related

C++/Unix/SQL Server

Jun 20, 2001

I am very new to this board and I am not sure whether the following question belongs to this board. I will ask it anyway.

Can someone tell me where (book or web site or an example) I can go to learn how to be able to connect to a SQL Server database in a unix (in my case Solaris) environment using C/C++. I have been doing database programming using Oracle, Acess on NT with C/C++/ODBC comfortabley. I just need to learn how to go about in a Unix environment.

Wango

View 1 Replies View Related

Connectivity From UNIX

Aug 7, 2001

Is there anything (other than the JDBC / ODBC) to get access to SQL Server from UNIX?

View 1 Replies View Related

Help: ADO With Unix And Oracle

Jul 20, 2005

We have done a complex software with VB using SQL Server through ADO. Nowour customer is planning to switch from SQL Server to Unix/Aix Oracle 8 DB.I'm a newbie both in Oracle and Unix and wonder how this will affect oursoftware. Would changing the connection string be enough (I quess not).Any help would be appreciated !Jyrki HamalainenLaukaa, Finlandjyrki . hamalainen @ ids . fi

View 1 Replies View Related

SQL Server (not 6.5) On Unix?

Apr 23, 2008

Are there any tools for installing SQL Server on a unix machine? (It seems to me like 6.5 might have been the last version that worked on unix?)

View 4 Replies View Related

File Transfer From UNIX To NT.

Jul 4, 2001

Hi Friends,

Is there any way to transfer a flat file from UNIX to Windows NT through an NT batch script without using FTP (and vice verssa)?

Thanks & Regards,

Raj

View 4 Replies View Related

Integration With Unix/linux

Aug 9, 2000

Hi
we are in an envireonment where we use unix/linux mostly.. there are a lot of apps that run on this environment(eg coldfusion)now the concern for us is to be able to access the sql database on the NT/win2k boxes..what could be a solution for this are there any drives that any one can suggest for talking from unix to nt??

thanks
sri

View 4 Replies View Related

Please Help! Converting From Unix Time

Nov 1, 1999

I have a date field from a Unix machine (ex. 917478174). I need to convert this date to 1/1/1999.

Any help?

Thanks!

-aw

View 1 Replies View Related

MSSQL/NT Or Sybase/Unix For WEB

Dec 22, 1998

Is anyone has an experience with choosing
between MS SQL7 (or 6.5) on NT Server box
and Sybase on Unix (UnixWare 2) box to
use this server as WEB server?
Could you tell just a couple of advantages
and disadvantages of each of those systems,
or to point me at the source of useful
for this compare information.
Any help is very appreciated.
Thanks

View 2 Replies View Related

ODBC Connection In UNIX

May 14, 2007

Hi Folks,

I need to access the MSSQL data in Oracle.

For that i need to first create the data source (ODBC Connection) to the MSSQL server on UNIX. Can anybody help me in creating the ODBC connection.

Thanks,
Amit

View 1 Replies View Related

Connecting To SQL Server From Unix

Feb 24, 2004

Has anyone tried to connect to a SQL Server 2K running on Windows 2000 from a unix machine? If so then could you provide me some help?
Thanks in advance

View 2 Replies View Related

Using Trusted Connection From Unix

Nov 4, 2006

Hi,Is it possible to connect to SQL Server using trusted connection fromunix? If yes, I'd like to know how.Regards,Thyagu.

View 4 Replies View Related

Accessing SQL-Server From UNIX

Apr 11, 2008



I have UNIX application, running on AIX, SUN and HP, (RISC & Itanium).
This application working with Oracle, via OCI, and OCCI, (I can use ODBC as well).

I would like replace Oracle with SQL-Sever.

Does there is a way/driver to access MS-SQL Server from Unix?

View 5 Replies View Related

SSIS FTP UNIX Delete

Mar 27, 2007



I know there are many threads out there for the aforesaid reason.

Do any know how to call ws-ftp or other ftp from ssis? Or any other way to go around SSIS FTP tool?

That will take care of the problem.

View 4 Replies View Related

How Can I Access SQL Server From SCO Unix?

Jan 11, 2007

We are running SCO Unix 5.0.5. We need a command line sql client that can connect to a MS SQL server running on a windows server. Can someone point me in the right direction? I don't want to write a sql client. I just want a command line sql client binary that is ready to work.

I want to do something like this in a unix shell script:

# sql -s 10.1.2.3 -u username -p password -f sqlcommandsinafile.txt -o sqlresults.txt

Any help would be appreciated....

View 1 Replies View Related

Connecting To MSAS From Unix

Feb 25, 2008



Dear all,

I am trying to connect Cognos to MSAS 2005 from an UNIX server (AIX). I am getting the following error:

QFS-ERR-0002 Unable to find or load the shared library '/cognos/c8/./bin/libykodp.so' (or one of its dependents) containing the provider 'MSAnalysis2005ODP'.

Is this file libykodp.so part of a SQL Server shared library (.o file) that must be installed on the UNIX server? Any pointers? Many thanks.

Best regards,
Pedro Martins

View 3 Replies View Related

Accessing SQL-Server From UNIX

Apr 12, 2008



Hi,

My program is running on UNIX, (SUN, AIX and HP), and work with Oracle.
I would like to use SQL-Server instead of Oracle, but the program must run on UNIX.

Is there is a way/driver to work with SQL-Server from UNIX?

*new in SQL-Server area...

Thanks

View 5 Replies View Related

Accessing Sql Server Data From Unix

Apr 5, 2001

Hello !

I am owrking in java developmenton solaris using weblogic6.0
Does any body know how to access sql server data from solaris.
If some body knows that, can you please post me the steps
that i need to do it.

Thanks
Veena

View 3 Replies View Related

MS SQL Client Software For UNIX Platform

Jul 5, 2001

How can i connect to the MS SQL server ruuning on Windows NT from a SOLARIS machine.?
Is there any client software available for this?

View 1 Replies View Related

Read UNIX File From SQL Server

Feb 6, 2004

Is it possibel to run a DTS job to read a file from unix server?

View 4 Replies View Related

UNIX Time Conversion Functions

May 28, 2006

A common problem in moving data between SQL Server and UNIX systems is converting to/from the SQL Server datetime format to the UNIX time format.

There are several UNIX time formats, but the most common is a signed 32-bit integer that represents time as the number of seconds between 1970-01-01 00:00:00 and a given time. The functions in the script can be use to convert between SQL Server datetime and this UNIX time format.

For more information on UNIX Time, please read this link:
http://en.wikipedia.org/wiki/Unix_time


For more information about SQL Server date/time conversions, refer to this link:
Date/Time Info and Script Links
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64762



The conversion of UNIX Time to SQL Server datetime is fairly trivial using the SQL Server DATEADD function, and this is the logic used by the F_UNIX_TIME_TO_DATETIME function in the script:

declare @UNIX_TIME int
select @UNIX_TIME = 1111111111
-- Using dateadd to add seconds to 1970-01-01
select [Datetime from UNIX Time] = dateadd(ss,@UNIX_TIME,'1970-01-01')

Results:

Datetime from UNIX Time
------------------------------------------------------
2005-03-18 01:58:31.000

(1 row(s) affected)


The conversion of SQL Server datetime to UNIX Time is more complex. SQL Server datetime is accurate to milliseconds so is necessary to either truncate or round off the time to a whole second. The function in the F_DATETIME_TO_UNIX_TIME script rounds the time down if milliseconds is less than 500 and up otherwise. A second problem is that UNIX Time is an integer, so it can only represent time from 1901-12-13 20:45:52 through 2038-01-19 03:14:07. The range of SQL Server datetime is 1753-01-01 through 9999-12-31, so the function in the script has logic to return a NULL if the datetime is outside the valid UNIX Time range. Another minor issue is that the SQL Server DATEDIFF function will not cover the full range of an integer value with seconds, so it is necessary to have additional logic in the function do cover the time from 1901-12-13 20:45:52 to 1901-12-14 00:00:00.

The function names created by this script are:
dbo.F_DATETIME_TO_UNIX_TIME( @DAY )
dbo.F_UNIX_TIME_TO_DATETIME( @UNIX_TIME )

The script also includes code to test and demo the functions.




if objectproperty(object_id('dbo.F_DATETIME_TO_UNIX_TIME'),'IsScalarFunction') = 1
begin drop function dbo.F_DATETIME_TO_UNIX_TIME end
go
create function dbo.F_DATETIME_TO_UNIX_TIME
( @DAY datetime )
returns int
as
/*
Function: F_DATETIME_TO_UNIX_TIME

Finds UNIX time as the difference in seconds between
1970-01-01 00:00:00 and input parameter @DAY after
rounding @DAY to the neareast whoie second.

Valid datetime range is 1901-12-13 20:45:51.500 through
2038-01-19 03:14:07.497. This range is limited to the smallest
through the largest possible integer.

Datetimes outside this range will return null.
*/
begin
declare @wkdt datetime

-- Return null if outside of valid UNIX Time range
if @DAY < '1901-12-13 20:45:51.500' or @DAY > '2038-01-19 03:14:07.497'
return null

-- Round off datetime to nearest whole second
select @wkdt = dateadd(ms,round(datepart(ms,@DAY),-3)-datepart(ms,@DAY),@DAY)

-- If date GE 1901-12-14
if @wkdt >= 712return datediff(ss,25567,@wkdt)

-- Handles time GE '1901-12-13 20:45:52.000 and LT 1901-12-14
return -2147472000-datediff(ss,@wkdt,712)

end
go
if objectproperty(object_id('dbo.F_UNIX_TIME_TO_DATETIME'),'IsScalarFunction') = 1
begin drop function dbo.F_UNIX_TIME_TO_DATETIME end
go
create function dbo.F_UNIX_TIME_TO_DATETIME
( @UNIX_TIME int )
returns datetime
as
/*
Function: F_UNIX_TIME_TO_DATETIME

Converts UNIX time represented as the difference
in seconds between 1970-01-01 00:00:00 to a datetime.

Any valid integer -2,147,483,648 through 2,147,483,647
can be converted to datetime.
*/
begin

return dateadd(ss,@UNIX_TIME,25567)

end
go

go
/*
Demo functions F_DATETIME_TO_UNIX_TIME and
F_UNIX_TIME_TO_DATETIME by converting a datetime
to UNIX time and back to datetime.
*/

select
[Input Datetime] = convert(varchar(23),DT,121),
[UNIX Time] = dbo. F_DATETIME_TO_UNIX_TIME(a.dt),
[Datetime from UNIX Time] =
-- Convert datetime to UNIX time an back to Datetime
convert(varchar(23),
dbo. F_UNIX_TIME_TO_DATETIME(dbo. F_DATETIME_TO_UNIX_TIME(a.dt)),121),
Note = .a.note
from
(
selectDT = getdate(),
Note = 'Current date'
union all
selectDT = dateadd(ms,500,getdate()),
Note = 'Current date + 500 ms'
union all
selectDT = dateadd(ms,750,getdate()),
Note = 'Current date + 750 ms'
union all
selectDT = '1901-12-13 20:45:51.500',
Note = 'Earliest datetime function can convert'
union all
selectDT = '2038-01-19 03:14:07.497',
Note = 'Last datetime function can convert'
union all
selectDT = '2001-09-09 01:46:40',
Note ='UNIX time 1000000000'
union all
selectDT = '2005-03-18 01:58:31',
Note = 'UNIX time 1111111111'
union all
selectDT = '2009-02-13 23:31:30',
Note ='UNIX time 1234567890'
union all
selectDT = '1901-12-14 00:00:00.000',
Note = 'Date time dateadd second limit'
union all
selectDT = '1901-12-13 23:59:59.000',
Note = 'Date time dateadd outside second limit'
union all
selectDT = '1901-12-13 20:45:51.497',
Note = 'Date time function cannot convert - low end'
union all
select
DT = '2038-01-19 03:14:07.500',
Note = 'Date time function cannot convert - high end'
union all
select
DT = '1753-01-01 00:00:00.000',
Note = 'Min Datetime'
union all
select
DT = '9999-12-31 23:59:59.997',
Note = 'Max Datetime'
) a


Results:

Input Datetime UNIX Time Datetime from UNIX Time Note
----------------------- ----------- ----------------------- --------------------------------------------
2006-05-29 23:34:11.517 1148945652 2006-05-29 23:34:12.000 Current date
2006-05-29 23:34:12.017 1148945652 2006-05-29 23:34:12.000 Current date + 500 ms
2006-05-29 23:34:12.267 1148945652 2006-05-29 23:34:12.000 Current date + 750 ms
1901-12-13 20:45:51.500 -2147483648 1901-12-13 20:45:52.000 Earliest datetime function can convert
2038-01-19 03:14:07.497 2147483647 2038-01-19 03:14:07.000 Last datetime function can convert
2001-09-09 01:46:40.000 1000000000 2001-09-09 01:46:40.000 UNIX time 1000000000
2005-03-18 01:58:31.000 1111111111 2005-03-18 01:58:31.000 UNIX time 1111111111
2009-02-13 23:31:30.000 1234567890 2009-02-13 23:31:30.000 UNIX time 1234567890
1901-12-14 00:00:00.000 -2147472000 1901-12-14 00:00:00.000 Date time dateadd second limit
1901-12-13 23:59:59.000 -2147472001 1901-12-13 23:59:59.000 Date time dateadd outside second limit
1901-12-13 20:45:51.497 NULL NULL Date time function cannot convert - low end
2038-01-19 03:14:07.500 NULL NULL Date time function cannot convert - high end
1753-01-01 00:00:00.000 NULL NULL Min Datetime
9999-12-31 23:59:59.997 NULL NULL Max Datetime

(14 row(s) affected)




Edit: Fixed minor bug that caused an overflow, instead of returning NULL, if input to function F_DATETIME_TO_UNIX_TIME was >= 9999-12-31 23:59:59.500.


CODO ERGO SUM

View 5 Replies View Related

Accessing SQL Server 2000 Via UNIX

Jul 20, 2005

Hi,I am having a problem accessing SQL Server 2000 via UNIX. I amaccessing SQL Server 2000 from Solaris using Sybase Open Client(CT-Lib). Here is the error message:CT-LIBRARY error:ct_connect(): network packet layer: internal net libraryerror: Net-Library operation terminated due to disconnectI have another SQL server 6.5 and I do not have any problems accessing6.5 using the same strategy. Can someone tell me how I shouldconfigure to access SQL Server 2000 from UNIX?Thanks,Amy

View 1 Replies View Related

MS SQL Server Client Under Linux/unix.

Jul 20, 2005

Hi, everyone!I was just wondering if any of you knows of a linux/unix client(preferably on the command line) that would connect to ms sql server?Any hints would be appreciated!Roumen.

View 1 Replies View Related

NFS Between Unix And Windows Server 2003 R2

Jan 18, 2008

I have a windows server 2003 R2 sharing a filesystem using NFS. I have created a group and passwd file and mapped the ids' to the unix login ids' . I', able to mount but when I try to cd to the directory I get "NFS access failed for server testsrvr: RPC: Authentication error". On the win2k3 server I'm getting an event error "There was a mapping failure". I have the Admin id on the win2k3 server mapped to the unix root login .

View 1 Replies View Related

Deleting Files With The FTP Client On A UNIX Box

May 2, 2008



I get the following error when I try to delete files using the FTP client in a SSIS package. This is the error I get.

Error: 0xC002918E at FTP Task, FTP Task: Unable to delete remote files using "FTP Connection Manager".

Task failed: FTP Task


This is a unix server. I'm able to delete the files using other FTP clients but the FTP client in the SSIS package cannot delete the files. I read on many places on the interent that this is a known MS bug. Let me know if there is some sort of work around for this. I'm using SQL servewr 2005 SSIS packages to accomplish this task..

Thanks

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved