How can I convert SQL Server 2008 Timestamp to DB2/iSeries Timestamp?
In DB2/iSeries I have a column that accepts Timestamp value. When I try to insert a timestamp value from the SQL 2008 table and into DB2/iSeries table I recieve the following error message:
OLE DB provider "IBMDA400" for linked server "XXX" returned message "SQL0180: Syntax of date, time, or timestamp value not valid.
Cause . . . . . : The string representation of a date, time, or timestamp value does not conform to the syntax for the specified or implied data type and format. *N is either the character string constant that is not valid or the column or host
variable that contained the string. If the name is *N, then the value is an expression specified in the statement. If the string was found in a host variable, the host variable number is 1. Recovery . . . : Ensure that the date, time, or
timestamp value conforms to the syntax for the data type it represents. Try the request again.".
Msg 7343, Level 16, State 2, Line 1
The OLE DB provider "IBMDA400" for linked server "XXX" could not INSERT INTO table "[IBMDA400]".
The SQL timestamp column contains the result in the following format:
2014-04-24 07:39:09.000
And my insert TSQL command is:
INSERT INTO OPENQUERY(XXX, 'Select "TimeOfDeal" from ABCD.TICKETS')
SELECT TimeOfDeal
FROM dbo.Tickets
WHERE DealId = 'ABC123'
I appreciate any help on this issue.
You are right it is a datetime data type in MS SQL, and a Timestamp in DB2.
I cast it to datetime2 and it worked.
Interesting. I would guess that somewhere under the covers, the date value gets converted to a string, and the different default string formats for datetime and datetime2 is illustrated with this statement:
SELECT convert(varchar, getdate()), convert(varchar, sysdatetime())
When I ran it, I got these values:
Feb 23 2015 12:31PM 2015-02-23 12:31:18.3708899
Now, why there is a conversion to string in the first place, I'm afraid I don't have any good answer to.
Erland Sommarskog, SQL Server MVP, [email protected]
Similar Messages
-
Can't uninstall SQL Server 2008 R2 Express
Hi all,
I have unfortunately let myself be persuaded (by a company selling a solution to us) to install SQL Server 2008 R2 Express on a Windows 2012 Standard Server.
At first it didn't work, the installation wizard told me to reboot the server - so I did. No change the checklist stopped at the same thing again telling me to reboot first...
Found out that I could install by using this command: SQLEXPR_x64_ENU.exe /SkipRules=RebootRequiredCheck /ACTION=install
Seemed to work, all fine! Rebooted and tried to install SQLManagmentStudio_x64_ENU.exe and got a compability warning saying that the SQL Server 2008 R2 Express is not compatible with Windows 2012 Standard Server.
I thought "Right, uninstall it and then install a new and compatible version" Can't uninstall!!
It stops with this error and nothing happens uninstall wise:
Windows Features
The following feature couln't be installed:
.NET Framework 3.5 (includes .NET 2.0 and 3.0)
Windows Server roles and features cannot be automatically installed or uninstalled via the Windows Feature Control Panel.
To install Windows Server roles and features, start Server Manager, or use the Server Manager cmdlets for Windows PowerShell.
When I look in remove roles and features there's no checkmark in .NET 3.5 Framework and it's also grayed out....
Please Help! :)
BR,
MicaelHello,
Try installing from the Command Prompt as explained on the following resource.
http://www.sqlcoffee.com/Troubleshooting101.htm
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
How to attached a sql server 2008 database on sql server 2005
Hi,
I have a backup of database designed over sql server 2008. I need to attacched this on a machine where sql server 2005 is installed and I am getting the message while attaching the database.
"The database can not be opened because it is version 661.
the server supports version 611 and earlier"You need to install/have another instance of SQL Server 2008, restore over there the database and perhaps create a SSIS package to move objects and data into SQL Server 2005
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to connect to SQL SERVER 2008 from labview
We have installed a SQL server 2008 in the local PC and through DSN we were able to connect to the database on the same PC . Now we have loaded SQL server 2008 in another PC but in same network but we are not able connect to the database. we can do it with connnectiong string?
Thanks for your reply,
We verified through DSN it works, we are able to connect to database by DSN.
But the issue is for connecting it to database we need to dynamically obtain the IP by choosing the Obtain the IP address automatically in TCP/IP Properties.
Whereas all the other devices connected to the PC are having static IP of 192.168.127.xxx from which we are getting the data. Also the PC IP address is 192.168.127.001 which is connected to the devices with a LAN switch to acquire the data from these devices.
Now i can either communicate with the devices using static IP address 192.168.127.1 or connect to database using dynamic address.
A separate LAN port will solve or is there solution for this issue? -
Can't login SQL Server 2008 R2 Express management studio
Hi i recently installed SQL Server 2008 R2 management studio. When I try to login i select 'Database engine' as the server type, I'm not sure what server name I'm
supposed to be using but I tried .\SQLEXPRESS and authentication is 'SQL server Authentication'. But as for login and password I don't have one. During the installation I was not prompted to provide a login/password. As with the 2005 server installation I
could by selecting 'mixed'. So how do i login for the first time on SQL server 2008 if i dont know/have my login/password?Hi,
Try below links :
http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
http://stackoverflow.com/questions/360141/how-to-connect-to-local-instance-of-sql-server-2008-express
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e880c3be-a874-4979-8874-7044c087318d/sql-server-express-default-username-and-password
sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **. -
Can I install SQL Server 2008 on Server 2012R2?
<v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0">
</v:f></v:formulas></v:stroke></v:shapetype>When trying to install SQL 2008 on server 12R2 I get an error msg stating "This program has compatibility issues" (Microsoft SQL Server (2008 or 2008 R2). Any ideas
or thoughts.....
Thanks
Z<v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f"><v:stroke
joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape alt="" id="Picture_x0020_2" o:spid="_x0000_i1025" style="width:304.5pt;height:237.75pt;" type="#_x0000_t75">
<v:imagedata o:href="cid:[email protected]" src="file:///C:\Users\zshams\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape>Hello,
Based on the following article, you must apply SP3 or SP4 for SQL Server 2008 to make it compatible with on Windows Server
2012 R2.
https://support.microsoft.com/kb/2681562/?wa=wsignin1.0
You can either perform a slipstream using the following Support article.
http://support.microsoft.com/kb/955392
or ignore the warning and continue with SQL Server 2008 setup, and when SQL Server installation is finished apply SP3 or SP4.
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
How can I uninstall SQL Server 2012 SP2
I have installed the SQL Server 2012 RTM and then SQL Server 2012 SP2 on top. I was under the impression that the "Programs and features" would allow me to uninstall the SP2 if necessary. There, I couldn't see any SQL Server 2012 SP2 but all
the components at the 11.2.5058 level, i.e. Microsoft SQL Server 2012 Setup? So, does it mean that I have to uninstall all components on the list from 11.2.5058 levels and presume that everything will rollback to 11.2.2100...? Thanks.I have installed the SQL Server 2012 RTM and then SQL Server 2012 SP2 on top. I was under the impression that the "Programs and features" would allow me to uninstall the SP2 if necessary.
There, I couldn't see any SQL Server 2012 SP2 but all the components at the 11.2.5058 level, i.e.
Microsoft SQL Server 2012 Setup? So, does it mean that I have to uninstall all components on the list from 11.2.5058 levels and presume that everything will rollback to 11.2.2100...? Thanks.
This is because you are looking at wrong place. Yes you need to go to add remove program but when you open that page there is no information about SP/CU updates. On top left side you need to click on
View installed updates and different screen would come there you can find SQL Server 2012 SP2
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP -
Can't convert SQL Server 7 procedures
When I create the Oracle Model, I get this error for every SQL Server 7 procedure that has parameters. I have a few procedures that don't have parameters, and they convert fine. Any help would be appreciated.
[SPCONV-ERR(1)]:[Parsing()],oracle.mtg.sqlserver7.parser.ParseException: Parse error at line 1, column 1.
Encountered: CREATE PROCEDURE
Example:
CREATE PROCEDURE just4.BS_AccountLoginSelect
@Username as varchar(20)
AS
BEGIN
SELECT LoginDate
FROM ab.just4.bs_usernamelogins
WHERE Username = @Username
ORDER BY LoginDate desc
ENDHi,
Try wrapping the parameter list in round brackets as shown below :
CREATE PROCEDURE just4.BS_AccountLoginSelect(
@Username as varchar(20) )
AS
BEGIN
SELECT LoginDate
FROM ab.just4.bs_usernamelogins
WHERE Username = @Username
ORDER BY LoginDate desc
END
Then, reparse the procedure. -
How to unpivot in SQL Server 2008 R2
Hi,
I have data like below:
AvgPetrolPrice
AvgKerosenePrice
AvgGasOilPrice
GrowthRatePetrol
GrowthRateKerosene
GrowthRateGasOil
685
689
688
0.21
0.21
0.21
I need output like below:
Product
Avg for the Year
Growth Rate for the Year
Petrol
685
0.21
Kerosene
689
0.21
Gas Oil
688
0.21
Please help ASAP.
Regards,
SriniSee example
DECLARE @Table TABLE
UserId INT,
Day1 INT NULL,
Day2 INT NULL,
Day3 INT NULL,
Day4 INt NULL,
DayMax Int NULL
INSERT INTO @Table(UserId, Day1, Day2, Day3, Day4, DayMax)
VALUES(1,10,null,20,3,null);
INSERT INTO @Table(UserId, Day1, Day2, Day3, Day4, DayMax)
VALUES(2,50,25,15,5,null);
SELECT UserId, DayQuantity AS DayMax FROM @Table
UNPIVOT (DayQuantity FOR DayNumber IN (Day1,Day2,Day3,Day4)) AS c
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to convert sql server database to SQL Server Express LocalDB??
How do I convert sql server database 2008 to SQL Server Express LocalDB??
Thanks
AruHello,
Please read the following article:
http://msdn.microsoft.com/en-us/library/hh873188.aspx
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
Oracle 9i to Sql server 2008 R2 migration
Hi,
We are having oracle 9i as database and migrating to sql server 2008.
Our oracle 9i database connects to another oracle databases and these databases are having different oracle version(9.2.0.8.0, 9.2.0.7.0,10.2.0.5.0,11.2.0.2.0,9.2.0.6.0,10.2.0.4.0,8.1.7.4.0 )
I do have two queries :
1) how to connect from Sql server 2008 R2 to different Oracle databases
2) How will other oracle databases connect to Sql server 2008 R2 databaseHi,
1) how to connect from Sql server 2008 R2 to different Oracle databasesYou can create "Linked Servers".
<<http://www.c-sharpcorner.com/uploadfile/suthish_nair/linked-servers-in-sql-server-2008/>>
2) How will other oracle databases connect to Sql server 2008 R2 databaseYou can create "Database link"
<<http://www.databasejournal.com/features/oracle/article.php/10893_3442661_2/Making-a-Connection-from-Oracle-to-SQL-Server.htm>>
But I do not know that old db (like 8i) can connect to 2008R2..
Regards, -
My English - bad =)
Download SQL Server 2008 R2 Express ADV SP1 from
http://www.microsoft.com/en-us/download/details.aspx?id=26729
this
SQLEXPRADV_x64_ENU.exe
Installed, opened Management Studio,
made the request
print @@version
result:
Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)
Feb 9 2007 22:47:07
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 6.1 (Build 7600: )
How to install the 2008 R2 Express ADV?? =)
I can't open the database version 661, because SQL Server 2005 - 612Hi,
You just installed SQl server management studio I guess and when you connected the system already had SQL Server 2005 and it connected to it.
If you are sure you installed express with advanced services (2008 r2) you need to go to Start..all program..can you see SQL server 2008 r2 listed ?
Now open SSMS for 2008 r2 and instead of connecting with default instance look for other instances in drop down in server name you would fine that for SQL Server 2008 r2 connect to that
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP -
Error converting SQL Server DDL and views to Oracle
I am trying to convert SQL Serve 2008 on windows to Oracle 11g using SQL Developer 3.2.20.09. I am using the jtds-1.2.7 drivers to connect to SQL Server.
I have made several attempts to run the conversion and am getting the tables, indexes, and triggers converted with no issue. However, my Procedures and views are not coming across. All of them are giving similar errors as:
"Failed To Convert Stored Procedure get_compvision > esp3.dbo.get_compvision:unexpected end of subtree: Line 0 Column 0"
When I log into the source SQL Server environment using SQL Developer, I get an empty SQL Editor window with "null" when I try to {right-click -> "Open"} on the Procedure.
Logging into SQL Server Administrator as the same user I can see the source code, so the issue appears to be related to SQL Developer and not my user privleges. I am a dbo alias in SQL Server.
In addition, if I click on a view, I can see the data and metadata, but not the SQL that defines the view. I see tabs for column, data, triggers, and details.
In addition, if I go to the "capture" for my Migration project and drill down to procedures, I can see them listed, but each and every procedure gives me a "/* DDL not accesible */" error. I get teh same results for views, triggers and indexes.
Can someone help me? I have been googling for days!
Edited by: user4714217 on Jan 24, 2013 12:54 PMSELECT v.vnd_c, CASE v.use_parent_addr_flg WHEN 0 THEN a.str_1 ELSE pa.str_1 END AS str_1,
CASE v.use_parent_addr_flg WHEN 0 THEN a.str_2 ELSE pa.str_2 END AS str_2,
CASE v.use_parent_addr_flg WHEN 0 THEN a.str_3 ELSE pa.str_3 END AS str_3,
CASE v.use_parent_addr_flg WHEN 0 THEN a.city ELSE pa.city END AS city,
CASE v.use_parent_addr_flg WHEN 0 THEN a.state ELSE pa.state END AS state,
CASE v.use_parent_addr_flg WHEN 0 THEN a.zipcode ELSE pa.zipcode END AS zipcode,
CAST((CASE v.use_parent_addr_flg WHEN 0 THEN (CASE a.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END)
ELSE (CASE pa.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END) END) AS char(1)) AS foreign_flg,
CASE v.use_parent_addr_flg WHEN 0 THEN a.country ELSE pa.country END AS country,
CASE v.use_parent_addr_flg WHEN 0 THEN a.cre_d ELSE pa.cre_d END AS cre_d,
CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_d ELSE pa.mod_d END AS mod_d,
CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_by ELSE pa.mod_by END AS mod_by
FROM dbo.om_vendor AS v LEFT OUTER JOIN
dbo.om_address AS a ON a.vnd_id = v.vnd_id AND a.addr_c = 1 INNER JOIN
dbo.om_owner AS o ON v.owr_id = o.owr_id INNER JOIN
dbo.om_address AS pa INNER JOIN
dbo.primary_vendors AS pv ON pa.vnd_id = pv.vnd_id ON o.part_id = pv.part_id
WHERE (pa.addr_c = 1)
WHICH TRANSLATES TO
SELECT v.vnd_c ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.str_1
ELSE pa.str_1
END str_1 ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.str_2
ELSE pa.str_2
END str_2 ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.str_3
ELSE pa.str_3
END str_3 ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.city
ELSE pa.city
END city ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.STATE
ELSE pa.STATE
END STATE ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.zipcode
ELSE pa.zipcode
END zipcode ,
(CASE v.use_parent_addr_flg
WHEN 0 THEN (CASE a.foreign_flg
WHEN 1 THEN 'Y'
ELSE 'N'
END)
ELSE (CASE pa.foreign_flg
WHEN 1 THEN 'Y'
ELSE 'N'
END)
END) foreign_flg ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.country
ELSE pa.country
END country ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.cre_d
ELSE pa.cre_d
END cre_d ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.mod_d
ELSE pa.mod_d
END mod_d ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.mod_by
ELSE pa.mod_by
END mod_by
FROM om_vendor v
LEFT JOIN om_address a
ON a.vnd_id = v.vnd_id
AND a.addr_c = 1
JOIN om_owner o
ON v.owr_id = o.owr_id
JOIN om_address pa
JOIN primary_vendors pv
ON pa.vnd_id = pv.vnd_id
ON o.part_id = pv.part_id
WHERE ( pa.addr_c = 1 );
Edited by: user4714217 on Jan 24, 2013 1:43 PM -
How can I convert an Excel (2008) document to Numbers. When I drag the Excel document onto the Numbers icon I get, "Import error. The file format is invalid.
That extension identifies the most current Excel file format, a format that can be opened by Numbers '09 (and by Numbers '08).
A check with Numbers '09 shows it capable of opening .xlsx files when right-clicked (and Numbers chose as the application to open, when double-clicked (if Numbers has been set as the default application to open this type of file, or when dragged to the Numbers icon in the dock.
I see two possibilities for Numbers inability to open it and the message you receive:
1. The file is not actually an Excel file, and the sender has added the .xlsx extension to the filename manually.
2. The file is an Excel file, but has somehow been corrupted.
Have you tried opening the file with a different application? The open source Office suites, OpenOffice.org, LibreOffice and NeoOffice can also open .xlsx files. If they're unable to open this one, that would point toward the file itself being faulty. You can download these applications from their rspective websites, linked in the names above. All request a donation to support future development, but only Neo requires one to have been made recently, and that only for the current release (which won't be necessary to open .xlsx files).
Regards,
Barry -
Tables missing in SQL Server 2008 for Hyperion Application
Hello Experts,
I am cuurently working on Hyperion Finacial close management (Account Reconciliation Manager) application version 11.1.2.3, O.S is Windows 2008 R2 and relational database is SQL Server 2008.
When I am trying to copy Account Profiles to a period say go to Manage->Periods->Right Click->Copy to Periods, I get the error:
Object arm_access is missing.
When I open SQL server studio, I can clearly see table 'ARM_ACCESS' but when I did a search on oracle support and google, I found out that it is a case sensitive issue and the table has to be in small letters.
So I created a new table 'arm_access' with all columns as there are in 'ARM_ACCESS' in SQL Server 2008, but it is not fetching any data.
Can anyone provide me the query that I can run to display the same structure and data for 'arm_access'?
If anyone is using the instance, he/she should be able to provide me the query that I can run in SQL server 2008 to populate the 'arm_access' table.
Appreciate your help as this is stopping my development work.
Thanks in advance.
Regards,
SumitHi Sumit,
Its just a wild guess am not sure with this.
i dont have idea about query in sql server. but it oracle it would be something like create table targettablename as select * from sourcetablename.
Ideally it will not allow to create you a table with that name if its already exists i mean its case insensitive (. Even if you have created manually make sure the db user you created with has select privilage granted for all users or the user you configured in Financial close management) or the DB might not be having select privilage .
Note:Have backups in place when you are manually to manipulate or changing the database user.
Thanks
Amith
Maybe you are looking for
-
Gross price for BASB Condition is not picking in Purchase Order invoice tab
Hi Gurus In taxinj -- conditional base column i added 362 and in pricing procedure for gross price in subtotal column i added 6 but even though when i click invoice tab while creating Purchase Order i am not getting gross price for BASB condition sam
-
Running a Swing program from another program
I'm having what is most likely newbie problems since I'm relatively new to Swing programming. Basically my situation is this: I've got a program that looks at its command line parameters and either runs through a series of actions or presents a Swing
-
Release Strategy Processor Names under Release Strategy tab for a PReq
Hello Experts, We have situation in Release Strategy for Purchase Requsitions in which we need to display all approvers names under the Release strategy tab for a Purchase Requisition. Senerio work as follows. Based on the Release strategy customizat
-
How do I add several discs as a single album to my iTunes library?
How do I add several discs as a single album to my iTunes library?
-
Could I upgrade software in Palm III and Palm V?
As the topic says, can I update firmware in Palm III and Palm V? Could a Palm III update package be beamed to Palm III from Palm V? If Palm V can be updated, plz post a link to an update pack and a short explanation how-to-update (if the forum rules