Desc doesn't show datetime columns from SQl Server
Hi Everyone,
I have working db link to sql server using hsodbc:
Oracle 10.2 on AIX using freetds odbc driver version 0.82.
I can access tables on sql server but oracle sees only varchars and numerics columns in a table.
Is there a way to select datetime columns from sql server using hsodbc?
when hsodbc does not show a certain data type it is commonly related to the fact that HSODBC doesn't support the related ODBC data type.
In general you have a data type in your SQL Server which is mapped to an ODBC data type by the ODBC driver. HSODBC then maps the ODBC data type to an Oracle equivalent and when the ODBC data type isn't supported by HSODBC it just drops it from the select list.
So for a root cause analysis an ODBC trace is required to determine the mapping of the FreeTDS ODBC driver.
With this info we can then compare the mapping documented in the HSODBC manual and if the ODBC data type isn't listed as a supported data type you then need to cast the data type on the source side to a different data type (for example varchar/char).
So please post the ODBC trace and I'll have a look.
- Klaus
Edited by: kgronau on Apr 2, 2013 12:50 PM
BTW, here the link to the HSODBC docu:
http://docs.oracle.com/cd/B19306_01/server.102/b14232.pdf
Oracle® Database
Heterogeneous Connectivity Administrator's Guide
10g Release 2 (10.2)
B14232-01
B.1 Mapping ANSI Data Types to Oracle Data Types Through an ODBC
Interface
Similar Messages
-
How to export an image column from SQL server to an excel
Hi team,
Would like to know how can i get an Image column storeed in SQL Server database to get copied in Excel (Hard Drive).
Requirement : Need to get Username, User email address and User photo in to an excel sheet from SQL server database.
Fix: I can get Username and Useremail adress however could not find a way to export /Copy user Image.
Please suggest
Thanks,
venkateshThis is an Oracle forum. Your question relates to SQL Server and Excel, neither of which are Oracle related.
-
How can I export image column from SQL Server 2000
Hi everybody,could someone tell me how can I export an entire column( pictures type) to a folder on disk?I've tried the textcopy.exe under the SQL installation's binn folder,it can only export one picture a time,I'm trying to find an automated way to export
the whole colum's images to a folder,I'm using SQL Server 2000.Vishal,thanks for the replay,I've tried the BCP method but it seems does not work on my Sql Server 2000,also the SSIS package method is demonstrated with Sql Server 2008 R2 and my machine does not have the visual application to try it.In the BCP method,I
got prompt indicating me that I wrote something wrong in the grammer,and I'm pretty sure that maybe I made something wrong in the below part,the grammer makes me confused
INSERT
INTO @sqlStatements
SELECT 'BCP "SELECT Photograph_Data FROM [ALBSCH_Trial].[dbo].[Photograph] WHERE Photograph_ID = '''
+ CAST(Photograph_ID AS VARCHAR(500)) + '''" queryout ' + @OutputFilePath
+ CAST(Photograph_ID AS VARCHAR(500)) + '.jpg -S localhost\SQLEXPRESS2008 -T -f C:\SQLTest\Images.fmt'
FROM dbo.Photograph -
Reading milliseconds from Sql server into oracle 10g
Hi,
We have a very time sensitive pressing requirements to be addressed immediately.
We need to read the date time column from sql server 2008 into oracle 10g.
We have a dblink established between the two servers and have tried to use sql server and sql native client 10 driver to read the dates from sql into oracle.This we are able to do very successfully.
The issue is in reading milliseconds stored in sql server.The millisecond part comes in as 00000 from sqlserver to oracle.These milliseconds are needed to identlfy the unique records.
For instance
SQL SERVER Oracle
source_id source id
01/01/2012 6:30:35:456 01/01/2012 6:30:35:000000.
Im issuing my query through Toad via Oracle to remote sql server using a dblink which connects using HS ODBC connection to sql server 2008(remote).
We have no control over sql server Db as this is remote third party DB.We just have select access to their tables to bring into our own oracle DB.
Any insight or help will be much appreciated.Hi,
Could you please send the following information -
- what version of HSODBC are you using ? Is it a 10.2 version ?
- what is the SQL*Server datatype of the column you are reading ?
- from Oracle could you issue -
describe sql_server_table@hsodbc
- what is the Oracle datatype shown for the column ?
Could you also run your tests using SQLPLUS instead of TOAD ? We don't support TOAD and need to know if the problem also happens when using SQLPLUS, to avoid it being a TOAD problem.
Also, 10.2 HSODBC is now desupported and you should be using the 11g Database Gateway for ODBC (DG4ODBC) which is a direct replacement for HSODBC. To use DG4ODBC your RDBMS needs to be at 10.2.0.4 or higher and DG4ODBC should be installed in a completely separate ORACLE_HOME from the existing 10.2 install.
Regards,
Mike -
Show data from sql server to oracle db
Hi,
I am using oracle 10g R1 on windows 2003 platform. On one machine database 10gR1 is running and on other machine sql server is running. I want to retrieve some data from sql server to oracle database. Please tell me how I can show data from sql server to oracle db.
ThanksTo make heterogeneous connection with oracle:
1.First make an ODBC connection, make entry in System DSN(to create a data source)
2.Make an entry in tnsnames.ora
3.Make an entry in listener.ora under SID_LIST_LISTENER
4.Make an entry in file named init<HS>.ora file located "oracle_base\oracle_home\db\hs\admin"
5.Restart the listener
e.g:
1. create a odbc system dsn named like 'sqlserver'
2. sqlserver= (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp) (HOST=xx.xx.xx.xx) (PORT=1521))
(CONNECT_DATA = (SERVICE_NAME=sqlserver))
(HS = OK)
3. (SID_DESC = (SID_NAME = sqlserver) (ORACLE_HOME = oracle_base\oracle_home\db) (PROGRAM = hsodbc) )
4.Create a file named initsqlserver.ora and make the following entry:
HS_FDS_CONNECT_INFO = sqlserver
Alternatively, you can copy the file named inithsodbc.ora and rename it to initsqlserver.ora
and edit as HS_FDS_CONNECT_INFO = sqlserver
5. lsnrctl reload listener_name
regards
adnan kaysar -
How can I get a date without the hour from sql server 2000 ?
hellou!
I have a JTable, and one of it's columns has to show a date. This date i have to show is specified as datetime on the Sql Server 2000 database where I have to take the data.
the query of the dataset attached to the JTable is something like "select * from Table".
The problem is that the JTable column that displays the date shows the date and the hour, for example:
7/10/04 0:00:00
and I need to show the date without the hour, only the 7/10/04. Can anyone tell me how to do that?
thank you very much! : )The easiest way to format a date is with java.text.SimpleDateFormat. When creating it you pass a format string which can be used to parse or format date objects.
SimpleDateFormat formater = new SimpleDateFormat( "MM/dd/yyyy" );
// Get date objects directly from sql
Date foundDate = result.getDate( 1 ); //where result is the ResultSet and 1 is the date column
String formatedDate = formater.format( foundDate );Now the JTable's table model can be adjusted to store a formated String instead of a Date. If for some reason it is required to store the value as a Date overload the table model to return the formated string when getValueAt is called. -
Error while reversing data from SQL Server to ODI
hi,
I was reversing data from SQL Server Java 1.6_022 in ODI Java 1.5, I was getting error Version Mismatch and I updated ODI Java version to 1.6_022.
And now, I am getting the below error while reversing the data from SQL Server database.
0 : 08001 : java.sql.SQLException: No suitable driver
Looking for the assistance on the same.
Thanks,
AbhayIf everything is fine the reversing should be fine. I would say check again if the Technology of the Model and the also the dataserver is created under the right Technology in topology too.
also if this doesn't help , Please tell us the steps you have carried so far . Also can you try selective reverse is it showing the tables. -
Why is my application name not showing up in the SQL Server connection properties?
If I understand correctly I should be able to have the application name from application.cfc show up in my SQL Server connection string (i.e. in the program_name column of sp_who2) if I go in to the DSN advanced settings and check "Application Name" under Client Settings.
However having done that I still don't see anything in the program name columns of the sp_who2 result set. Any ideas?
Thanks!I drew my shape, then went to the GRADIENT panel and clicked in the default gradient box to apply the default white to black gradient. Normally you can click on either color to change it using the ways I described in my original post but those are not available to me. The only way I could add a color was to drag it from the SWATCHES panel into the gradient colors slider.
This means that I cannot make changes to colors directly in the gradient panel like before. I have to make changes to the individual colors but clicking on the color in the gradient slider then going to the COLOR panel and adjusting the color there. Or by dragging in a whole new color from the COLOR or SWATCHES panels. This is really killing my work flow. -
How to convert rows to columns in sql server 2008
How to convert rows to columns in sql server 2008 using the GROUP BY function? (only one query allowed)
Lookup the Pivot transformation. From BOL:
The Pivot transformation makes a normalized data set into a less normalized
but more compact version by pivoting the input data on a column value. For
example, a normalized Orders data set that lists customer name, product, and quantity purchased typically has multiple rows for any customer who purchased multiple products, with each row for that customer showing order
details for a different product. By pivoting the data set on the product column, the Pivot transformation can output a data set with a
single row per customer. That single row lists all the purchases by the customer, with the product names shown as column names, and the quantity shown as a value in the product column. Because not every customer purchases every product, many columns may contain
null values.
When a dataset is pivoted, input columns perform different roles in the pivoting process. A column can participate in the following ways:
The column is passed through unchanged to the output. Because many input rows
can result only in one output row, the transformation copies only the first
input value for the column.
The column acts as the key or part of the key that identifies a set of
records.
The column defines the pivot. The values in this column are associated with
columns in the pivoted dataset.
The column contains values that are placed in the columns that the pivot
creates.
Paul -
Problems with TIMESTAMP Field from SQL Server
OBIEE 11g
Hi All,
I want to convert data into OBIEE that is coming from a TIMESTAMP field in SQL Server Database. So in SQL Server field has data like '9/20/2012 12:05:08 AM'. I have first changed the datatype in physical layer to DATETIME and then in BMM I do a CAST(<DATE_FIELD> AS DATE). On the frontend when I use this column the error I get back is [nQSError: 59030] Illegal data type conversion from source type: VARBINARY to target type: TIMESTAMP. (HY000). Does anyone know a workaround or solution.
Thanks in Advance!Hi Guys,
None of the solutions you mentioned have worked unfortunately. I have a date column and another column that holds user id. I basically want to do a count of all the user id's where that particular date column is NULL. I have checked in the physical layer and the date column in question is coming from SQL Server as a TIMESTAMP datatype. So I initially did not change anything and brought the column in as is but that did not work out. I then tried to change the datatype in the physical layer to DATETIME and then also DATE. After changing the datatype in the physical layer in the BMM I would do a CAST(<date column> as DATE) and this still did not work. I then tried to just change the datatype to DATETIME and DATE without doing the CAST in the BMM and this still did not work. Not too sure what to do now. -
How to convert from SQL Server table to Flat file (txt file)
I need To ask question how convert from SQL Server table to Flat file txt file
Hi
1. Import/Export wizened
2. Bcp utility
3. SSIS
1.Import/Export Wizard
First and very manual technique is the import wizard. This is great for ad-hoc and just to slam it in tasks.
In SSMS right click the database you want to import into. Scroll to Tasks and select Import Data…
For the data source we want out zips.txt file. Browse for it and select it. You should notice the wizard tries to fill in the blanks for you. One key thing here with this file I picked is there are “ “ qualifiers. So we need to make
sure we add “ into the text qualifier field. The wizard will not do this for you.
Go through the remaining pages to view everything. No further changes should be needed though
Hit next after checking the pages out and select your destination. This in our case will be DBA.dbo.zips.
Following the destination step, go into the edit mappings section to ensure we look good on the types and counts.
Hit next and then finish. Once completed you will see the count of rows transferred and the success or failure rate
Import wizard completed and you have the data!
bcp utility
Method two is bcp with a format file http://msdn.microsoft.com/en-us/library/ms162802.aspx
This is probably going to win for speed on most occasions but is limited to the formatting of the file being imported. For this file it actually works well with a small format file to show the contents and mappings to SQL Server.
To create a format file all we really need is the type and the count of columns for the most basic files. In our case the qualifier makes it a bit difficult but there is a trick to ignoring them. The trick is to basically throw a field into the
format file that will reference it but basically ignore it in the import process.
Given that our format file in this case would appear like this
9.0
9
1 SQLCHAR 0 0 """ 0 dummy1 ""
2 SQLCHAR 0 50 "","" 1 Field1 ""
3 SQLCHAR 0 50 "","" 2 Field2 ""
4 SQLCHAR 0 50 "","" 3 Field3 ""
5 SQLCHAR 0 50 ""," 4 Field4 ""
6 SQLCHAR 0 50 "," 5 Field5 ""
7 SQLCHAR 0 50 "," 6 Field6 ""
8 SQLCHAR 0 50 "," 7 Field7 ""
9 SQLCHAR 0 50 "n" 8 Field8 ""
The bcp call would be as follows
C:Program FilesMicrosoft SQL Server90ToolsBinn>bcp DBA..zips in “C:zips.txt” -f “c:zip_format_file.txt” -S LKFW0133 -T
Given a successful run you should see this in command prompt after executing the statement
Starting copy...
1000 rows sent to SQL Server. Total sent: 1000
1000 rows sent to SQL Server. Total sent: 2000
1000 rows sent to SQL Server. Total sent: 3000
1000 rows sent to SQL Server. Total sent: 4000
1000 rows sent to SQL Server. Total sent: 5000
1000 rows sent to SQL Server. Total sent: 6000
1000 rows sent to SQL Server. Total sent: 7000
1000 rows sent to SQL Server. Total sent: 8000
1000 rows sent to SQL Server. Total sent: 9000
1000 rows sent to SQL Server. Total sent: 10000
1000 rows sent to SQL Server. Total sent: 11000
1000 rows sent to SQL Server. Total sent: 12000
1000 rows sent to SQL Server. Total sent: 13000
1000 rows sent to SQL Server. Total sent: 14000
1000 rows sent to SQL Server. Total sent: 15000
1000 rows sent to SQL Server. Total sent: 16000
1000 rows sent to SQL Server. Total sent: 17000
1000 rows sent to SQL Server. Total sent: 18000
1000 rows sent to SQL Server. Total sent: 19000
1000 rows sent to SQL Server. Total sent: 20000
1000 rows sent to SQL Server. Total sent: 21000
1000 rows sent to SQL Server. Total sent: 22000
1000 rows sent to SQL Server. Total sent: 23000
1000 rows sent to SQL Server. Total sent: 24000
1000 rows sent to SQL Server. Total sent: 25000
1000 rows sent to SQL Server. Total sent: 26000
1000 rows sent to SQL Server. Total sent: 27000
1000 rows sent to SQL Server. Total sent: 28000
1000 rows sent to SQL Server. Total sent: 29000
bcp import completed!
BULK INSERT
Next, we have BULK INSERT given the same format file from bcp
CREATE TABLE zips (
Col1 nvarchar(50),
Col2 nvarchar(50),
Col3 nvarchar(50),
Col4 nvarchar(50),
Col5 nvarchar(50),
Col6 nvarchar(50),
Col7 nvarchar(50),
Col8 nvarchar(50)
GO
INSERT INTO zips
SELECT *
FROM OPENROWSET(BULK 'C:Documents and SettingstkruegerMy Documentsblogcenzuszipcodeszips.txt',
FORMATFILE='C:Documents and SettingstkruegerMy Documentsblogzip_format_file.txt'
) as t1 ;
GO
That was simple enough given the work on the format file that we already did. Bulk insert isn’t as fast as bcp but gives you some freedom from within TSQL and SSMS to add functionality to the import.
SSIS
Next is my favorite playground in SSIS
We can do many methods in SSIS to get data from point A, to point B. I’ll show you data flow task and the SSIS version of BULK INSERT
First create a new integrated services project.
Create a new flat file connection by right clicking the connection managers area. This will be used in both methods
Bulk insert
You can use format file here as well which is beneficial to moving methods around. This essentially is calling the same processes with format file usage. Drag over a bulk insert task and double click it to go into the editor.
Fill in the information starting with connection. This will populate much as the wizard did.
Example of format file usage
Or specify your own details
Execute this and again, we have some data
Data Flow method
Bring over a data flow task and double click it to go into the data flow tab.
Bring over a flat file source and SQL Server destination. Edit the flat file source to use the connection manager “The file” we already created. Connect the two once they are there
Double click the SQL Server Destination task to open the editor. Enter in the connection manager information and select the table to import into.
Go into the mappings and connect the dots per say
Typical issue of type conversions is Unicode to non-unicode.
We fix this with a Data conversion or explicit conversion in the editor. Data conversion tasks are usually the route I take. Drag over a data conversation task and place it between the connection from the flat file source to the SQL Server destination.
New look in the mappings
And after execution…
SqlBulkCopy Method
Sense we’re in the SSIS package we can use that awesome “script task” to show SlqBulkCopy. Not only fast but also handy for those really “unique” file formats we receive so often
Bring over a script task into the control flow
Double click the task and go to the script page. Click the Design script to open up the code behind
Ref.
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
Error while exporting data from sql server to excel
Hi,
I am trying to export data from sql server to excel.
The query that I used is s follows
INSERT INTO OPENROWSET( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Folder1\abc.xls','select * from [Sheet1$A1:IV65000]')
select
column1,column2.... from Table1
I get the following error message while doing so..
String or binary data would be truncated.
The statement has been terminated.
One of the column's holds data more than 225 characters.
What is the way to correct this, i want the whole data of the colum in the excel sheet.I haven't had great luck with the INSERT INTO OPENROWSET method. Can you try one of the many samples from one of these 3 links?
http://www.excel-sql-server.com/excel-sql-server-import-export-using-vba.htm#Excel%20Data%20Export%20to%20SQL%20Server%20Test%20Code
http://www.mssqltips.com/sqlservertip/1540/insert-update-or-delete-data-in-sql-server-from-excel/
https://www.simple-talk.com/sql/database-administration/getting-data-between-excel-and-sql-server-using-odbc--/
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
I have a problem where I have an SSIS package (SQL Server 2005) that won't run properly from SQL Server Agent, but it runs fine when kicked off manually from Integration Services -> Run Package or when run in debug from Visual Studio.
The first step in the package checks for the existance of a file via a script task. The script looks like this...
Code Block
Public Sub Main()
Dim TaskResult As Integer
Dim ImportFile As String = CStr(Dts.Variables("BaseDirectory").Value) + CStr(Dts.Variables("ImportDirectory").Value) + CStr(Dts.Variables("ImportFile").Value)
If Dir(ImportFile) = "" Then
Dts.TaskResult = Dts.Results.Failure
Else
Dts.TaskResult = Dts.Results.Success
End If
Return
End Sub
This script runs fine and the file is seen as expected when I run the package manually. But as a step in a SQL Server Agent job, it doesn't see the file.
The SQL Server Agent service is set to start up / log on as a Local System Account. I've also tried setting up a credential / proxy (using an account that I know can see and even move / rename the file) to run the job as but that didn't seem to help.
The package is being run from SQL Server (stored in MSDB) and is set to rely on SQL Server for sensitive information, so I don't think that's an issue; other packages are set up like this in terms of sensitive data and run fine.
Any ideas why my script can't "see" the file I'm looking at when it's kicked off by SQL Server agent? I've looked and looked...I can't seem to figure this out. I would really appreciate any help you might be able to offer up.If the variables are fine, then I think it is very likely that this is security related. Since the Agent is running under the local system account, have you verified that the local account can access the file? When you tried the proxy account, are you positive that it was set up properly, and that the account had the permissions to read the file?
Another thing to check - is this a local file or is on another computer? If it is on another computer, make sure you are using a UNC path and not a mapped drive. -
Related to migration of db from sql server to oracle 11 g
We're trying to migrate a Sql server managment studio database to Oracle 11g using SQL Developer 4.0. We can successfully connect to both Sql server managment studion 8.0 and Oracle 11g using the tool, as well as click through the Migration Wizard and start the migration.
This opens the Database Migration dialog box, which indicates the capture process starts normally. we get the following error:
ora :01440 : can not insert null into migrlog (id column) ,
\and then after some time , i get an error that migration failed
i am not getting the reason,I thing it may be due to reason that , I have table's column in my source db with more than 30 character.
If i am migrating one by one table . then it is not giving any error, and identifier name is getting shrink in 30 character. but i am not getting the view , stored procedure , indexes , and others
then what is the solution for that, somebody pls suggest any help?????????????Pl do not post duplicates - related to migration of db from sql server to oracle 11 g
Continue the discussion in your original thread
The error message is explicitly clear
ora :01440 : can not insert null into migrlog (id column)
Your process is trying to insert a NULL value into the ID column, which presumably cannot be NULL -
"URl has already been reserved".
Reporting services for port 80 and 443 works fine both for reports and reportingserver on SQL server 2008 R2. But when I try to upgrade from SQL server 2008 R2 to 2012 this error pops up. How to make sure before upgrading regarding reporting services that
URL reserves and SSL are fine or how to fix reporting services are upgrade like repair install.
ThanksHi yashmitl,
In your case, please running the following command to check the current URL reservations on http.sys.
netsh http show urlacl
Then, please delete the URL reservation by executing the following command try to resolve the issue.
netsh http delete urlacl <url>
There is a similar issue, you can refer to it.
http://social.technet.microsoft.com/Forums/en-US/d5204dd3-e26d-4592-8ef0-a94005fc46a5/the-url-has-already-been-reserved?forum=sqlreportingservices
Hope this helps.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support
Maybe you are looking for
-
Adding music files to iDVD project
Hello All, Sorry if this has been asked before... I didn't seem to find anything in my "search" of past posts... A friend of mine recently passed away & I am (trying to) putting together a dvd to send to his brother that includes some home video of u
-
How do I make Preview the default instead of Adobe Reader?
When Adobe Reader is installed it makes itself the default and then doesn't provide you anyway to change it that I know of. I tried uninstalling Adobe Reader but then realized that that is the only way to view PDFs from a web browser and therefore ha
-
How to check DFS replication status in windows 2008 r2 file server
Hi, I have created File server DFS namespace between 2 windows 2008 R2 server. namespace mode is 2008. I have copied 3 TB data on file server 1. now it is getting replicated from file server 1 to file server 2. till now the data is not fully replicat
-
if i am on a wifi network using the internet, if someone tries to call me will my iphone just drop wifi and will the call still go through?
-
Hi I need to move the Purchase Requistion, data from legacy to Oracle I found the interface table "PO_REQUISITIONS_INTERFACE" for Requistions, There is oracle Concurrent program also to move the data from the interface table, i am interested to know