Junk charecter in SQL Server 2000 varchar
Hi all,
My application works with both SQL Server as well as Oracle.For SQL Server 2000 to create primary key in to one table i am using UuidCreate() function which returns unique key of length 32.But in case of SQL Server 2000, it some times accepts junk charecters. For Oracle database with this function i am not gettng any error,But SQL Server sometime accepts junk charecter.The data type used for that column is varchar.Can you please suggest me the root cause of it and solution for it.
Thanks in advance,
Anjela
Are you doing that in a SAP application or in a self written one? In the latter case this is the wrong forum...
Markus
Similar Messages
-
Junk arabic details while transfer arabic data from sql server 2000 to orac
We are facing problems to view arabic details in oracle which is transfered from sql server 2000 .
In oracle database we are using charecterset is UTF8.
NLS_CHARACTERSET :UTF8 and NLS_NCHAR_CHARACTERSET:UTF8
Sqlr server collation is SQL_Latin1_General_CP1256_CI_AS.
we are using stored procedure for transfering data from sql server 2000 to oracle.
And i am able to view some arbic details which is not transfered from sql server 2000.
I thing some configuration i need to change in sql server.
Can any one help me out from this issue?I know that this is not the correct forum to ask this question.
If someone knows this issue please help me.
We were using to import from another intermediate sqlserver and it was successfull.
And more over i cannot change anything in oracle database which is live.
The issue is we are using one intermediate sqlserver for transfering the data to oracle apart from main sqlserver.
now we want to stop the intermediate and need to transfer from main sqlserver to oracle Db.
i guess , i need to change some configuration in main sql server.
Main sql server and intermediate have the same collation.
Could you please help me out from this problem? -
Exceptions thrown while importing tables from SQL Server 2000
Hi all,
<MyProblem:
I cannot import the tables defined in my local SQL Server. An exception is thrown --oracle.jdeveloper.cm.ds.db.ValidationException: Columns of type varchar cannot have a size specified.
/>
<What I have done:
In Oracle JDev 10g, Created a new DB connection called "SQLServerConnection" to connect to the SQL Server and it works fine. I am able to see all tables by expanding the connection.
During the creation of a new partner link named "DBAdapter", I use the adapter wizard to select DB Adapter and then select the "SQLServerConnection" DB connection I have created. I select Perform an Operation on a Table and then check Select. After I pressed OK button on the[i] Import Tables dialog, a Error messege box emmerged indicating the Exception: Columns of type varchar cannot have a size specified.
I try to change the data type of the columns of the tables to char, there is still similar exception (Columns of type char cannot have a size specified).
/>
I got the stack trace from the prompt by using jdev.exe.
<StackTrace:
oracle.jdeveloper.cm.ds.db.ValidationException: Columns of type varchar cannot h
ave a size specified.
at oracle.jdeveloper.offlinedb.OfflineDBTableValidator.validateObject(Of
flineDBTableValidator.java:116)
at oracle.jdeveloper.cm.ds.db.AbstractDBObjectProvider.validateObject(Ab
stractDBObjectProvider.java:601)
at oracle.jdeveloper.offlinedb.OfflineDBObjectProvider.updateObject(Offl
ineDBObjectProvider.java:952)
at oracle.tip.tools.ide.pm.wizard.adapter.db.DBAdapterDescriptorGenerato
r.generate(DBAdapterDescriptorGenerator.java:274)
at oracle.tip.tools.ide.pm.wizard.adapter.db.DBAdapterSelectTablePage.ac
tionPerformed(DBAdapterSelectTablePage.java:451)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
86)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:245)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:141)
at java.awt.Dialog$1.run(Dialog.java:540)
at java.awt.Dialog.show(Dialog.java:561)
at java.awt.Component.show(Component.java:1133)
at java.awt.Component.setVisible(Component.java:1088)
at oracle.bali.ewt.wizard.WizardDialog.runDialog(Unknown Source)
at oracle.tip.tools.ide.pm.wizard.adapter.techAdapterWizard.display(tech
AdapterWizard.java:151)
at oracle.tip.tools.ide.pm.bpelgraph.editors.PartnerLinkEditPage.handleA
dapterWizard(PartnerLinkEditPage.java:311)
at oracle.tip.tools.ide.pm.bpelgraph.editors.PartnerLinkEditPage.actionP
erformed(PartnerLinkEditPage.java:893)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
86)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:245)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
31)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:141)
at java.awt.Dialog$1.run(Dialog.java:540)
at java.awt.Dialog.show(Dialog.java:561)
at oracle.tip.tools.ide.pm.bpelgraph.editors.PartnerLinkDialog.create(Pa
rtnerLinkDialog.java:90)
at oracle.tip.tools.ide.pm.bpelgraph.collaxalaf.BPELGraphPane.createPart
nerLink(BPELGraphPane.java:324)
at oracle.tip.tools.ide.pm.bpelgraph.collaxalaf.BPELDNDDropHandler.handl
eDrop(BPELDNDDropHandler.java:77)
at oracle.tip.tools.ide.common.graph.DefaultGraphPaneDropTargetListener.
routeToDropHandler(DefaultGraphPaneDropTargetListener.java:212)
at oracle.tip.tools.ide.common.graph.DefaultGraphPaneDropTargetListener.
handleDrop(DefaultGraphPaneDropTargetListener.java:200)
at oracle.tip.tools.ide.pm.bpelgraph.collaxalaf.BPELGraphPaneDropTargetL
istener.handleDrop(BPELGraphPaneDropTargetListener.java:75)
at oracle.tip.tools.ide.common.graph.DefaultGraphPaneDropTargetListener.
drop(DefaultGraphPaneDropTargetListener.java:260)
at java.awt.dnd.DropTarget.drop(DropTarget.java:398)
at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTarget
ContextPeer.java:542)
at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextP
eer.java:52)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEven
t(SunDropTargetContextPeer.java:805)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Su
nDropTargetContextPeer.java:743)
at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:29)
at java.awt.Component.dispatchEventImpl(Component.java:3494)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:
3269)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3123)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
/>
<Oracle:
Oracle JDeveloper 10.1.2.0.0 (Build 1811)
Oracle IDE 10.1.2.17.84
Business Components Version 10.1.2.17.96
UML Modelers Version 10.1.2.16.71
Versioning Support 10.1.2.16.71
WebDAV Support Version 10.1.2.16.71
Struts Modeler Version 10.1.2.6.15
BPEL Designer 10.1.2.0.0 (Build 050504)
Designer Generators Framework 10.1.2.7.56
ADF UIX 2.2.16
java.version 1.4.2_06
java.home E:\OraBPELPM\jdk\jre
java.vm.name Java HotSpot(TM) Client VM
java.vm.vendor Sun Microsystems Inc.
java.vm.version 1.4.2_06-b03
user.language zh
user.region <no value assigned>
user.name Administrator
user.home C:\Documents and Settings\Administrator
user.dir E:\OraBPELPM\integration\jdev\jdev\bin
os.name Windows 2003
os.version 5.2
os.arch x86
http.proxyHost jproxy.nju.edu.cn
http.proxyPort 8080
/>
<SQL Server:
Microsoft SQL Server 2000 with the Microsoft SQL Server 2000 Driver for JDBC Service Pack 3 installed
/>
By the way, I have read the thread Thread: DB Adapter not importing SQL Svr tables and take some of their advises but the problem still exist.
Any help would be greatly appreciated.
Thanks!
And Merry Christmas to all!Hi, ronen!
Thank you.
I followed the steps and the there were no exceptions then.
However, new runtime error emerged.
The BPEL PM Server cannot build Toplink Session. But I do not know why.
The messeges from the "Start BPEL PM Server" console about this project (named "TryDB") is as following (DoSelect is the service name of the DB Adapter):
<::Outbound><oracle.tip.adapter.db.ox.TopLinkXMLProjectInitializer initialize> I
nitializing an existing toplink project for use by the database adapter.
<::Outbound><oracle.tip.adapter.db.ox.TopLinkXMLProjectInitializer initialize> I
nitializing an existing toplink project for use by the database adapter.
<2006-01-10 16:03:02,656> <INFO> <default.collaxa.cube.compiler> 正在验证 "E:\Or
aBPELPM\integration\orabpel\domains\default\tmp\.bpel_TryDB_1.0.jar\TryDB.bpel"
<2006-01-10 16:03:05,156> <INFO> <default.collaxa.cube.engine.deployment> <CubeP
rocessFactory::generateProcessClass>
流程 "TryDB" (修订 "1.0") 编译成功。
<2006-01-10 16:03:05,765> <INFO> <default.collaxa.cube.engine.deployment> 流程 "
TryDB" (修订标记 "1.0") 已成功加载。
06/01/10 16:03:34 Tutalii: E:\OraBPELPM\integration\orabpel\lib\orabpel.jar arch
ive
<2006-01-10 16:03:34,500> <INFO> <default.collaxa.cube.ws> <AdapterFramework::Ou
tbound> file:/E:/OraBPELPM/integration/orabpel/domains/default/tmp/.bpel_TryDB_1
.0.jar/DoSelect.wsdl [ DoSelect_ptt::DoSelectSelect(DoSelectSelect_inparameters,
AirlineTableCollection) ] - Using JCA Connection Pool - max size = <unbounded>
<2006-01-10 16:03:35,093> <ERROR> <default.collaxa.cube.ws> <Database Adapter::O
utbound> <oracle.tip.adapter.db.DBManagedConnectionFactory acquireClientSession>
unable to build the TopLink Session
<2006-01-10 16:03:35,125> <ERROR> <default.collaxa.cube.ws> <Database Adapter::O
utbound> <oracle.tip.adapter.db.DBInteraction executeOutboundRead> unable to exe
cute the NamedQuery: TryDB.AirlineTable.DoSelectSelect
<2006-01-10 16:03:35,125> <ERROR> <default.collaxa.cube.ws> <AdapterFramework::O
utbound> file:/E:/OraBPELPM/integration/orabpel/domains/default/tmp/.bpel_TryDB_
1.0.jar/DoSelect.wsdl [ DoSelect_ptt::DoSelectSelect(DoSelectSelect_inparameters
,AirlineTableCollection) ] - Could not invoke operation 'DoSelectSelect' against
the 'Database Adapter' due to:
ORABPEL-11622
无法创建/访问 TopLink 会话.
此会话用于连接到数据存储。.
有关特定异常错误, 请参阅根异常错误。您可能需要在 j2ee/home/application-deploymen
ts/default/DbAdapter/oc4j-ra.xml 中配置连接设置并重新启动服务器。由 $J2EE_HOME/a
pplication-deployments/default/DbAdapter/oc4j-ra.xml 导致。
<2006-01-10 16:03:35,125> <INFO> <default.collaxa.cube.ws> <AdapterFramework::Ou
tbound> Change logging level for Logger 'default.collaxa.cube.ws' to DEBUG to se
e full error stack
<2006-01-10 16:03:35,125> <ERROR> <default.collaxa.cube.ws> <AdapterFramework::O
utbound> file:/E:/OraBPELPM/integration/orabpel/domains/default/tmp/.bpel_TryDB_
1.0.jar/DoSelect.wsdl [ DoSelect_ptt::DoSelectSelect(DoSelectSelect_inparameters
,AirlineTableCollection) ] - Rolling back JCA LocalTransaction
And in the Audit part of the BPEL Console, I got the following "details"
<remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
<part name="code">
<code>4003</code>
</part>
<part name="summary">
<summary>file:/E:/OraBPELPM/integration/orabpel/domains/default/tmp/.bpel_TryDB_1.0.jar/DoSelect.wsdl [
DoSelect_ptt::DoSelectSelect(DoSelectSelect_inparameters,AirlineTableCollection) ] - WSIF JCA Execute of operation
'DoSelectSelect' failed due to: ????/?? TopLink ??. ?????????????. ; nested exception is: ORABPEL-11622 ????/??
TopLink ??. ?????????????. ????????, ??????????????? j2ee/home/application-deployments/default/DbAdapter/oc4j-ra.xml
????????????????? $J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml ???</summary>
</part>
<part name="detail">
<detail>??????: ????????? [com.microsoft.jdbc.sqlserver.SQLServerDriver]?</detail>
</part>
</remoteFault>
My oc4j-ra.xml has the following content (SQLServerConnection is the name of the connection of SQL Server database):
<connector-factory location="eis/DB/SQLServerConnection" connector-name="Database Adapter">
<config-property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<config-property name="connectionString" value="jdbc:microsoft:sqlserver://localhost:1433;SelectMethod=cursor;databasename=lxbpel"/>
<config-property name="userName" value="bpel"/>
<config-property name="password" value="bpel"/>
<config-property name="minConnections" value="5"/>
<config-property name="maxConnections" value="5"/>
<config-property name="minReadConnections" value="1"/>
<config-property name="maxReadConnections" value="1"/>
<config-property name="usesExternalConnectionPooling" value="false"/>
<config-property name="dataSourceName" value=""/>
<config-property name="usesExternalTransactionController" value="false"/>
<config-property name="platformClassName" value="oracle.toplink.internal.databaseaccess.SQLServerPlatform"/>
<config-property name="usesNativeSequencing" value="true"/>
<config-property name="sequencePreallocationSize" value="50"/>
<config-property name="tableQualifier" value=""/>
</connector-factory>
I think this configuration in this oc4j-ra.xml is fine
So please help me again. I owe you so much.
Thank you! -
My sample dataset (below) contains 3 groups -- 'a', 'b', 'c'. I need to retrieve the Min(startDate) and Max(EndDate) for each group so that the output looks something like this (date format not an issue):
fk minStart maxEnd
a 1/13/1985 12/31/2003
b 2/14/1986 12/31/2003
c 4/26/1987 12/31/2002
What is the Tsql to perform this type of operation? Note: the actual data resides in a sql server 2000 DB. If the Tsql is different between version 2000 and the later versions -- I would be grateful for both versions of the Tsql
--I noticed that multiple lines of Insert values doesn't work in Sql Server 2000 -- this sample is in Sql Server 2008
create table #tmp2(rowID int Identity(1,1), fk varchar(1), startDate datetime, endDate datetime)
insert into #tmp2
values
('a', '1/13/1985', '12/31/1999'),
('a', '3/17/1992', '12/31/1997'),
('a', '4/21/1987', '12/31/2003'),
('b', '2/14/1986', '12/31/2003'),
('b', '5/30/1993', '12/31/2001'),
('b', '6/15/1994', '12/31/2003'),
('b', '7/7/2001', '12/31/2003'),
('c', '4/26/1987', '12/31/1991'),
('c', '8/14/1992', '12/31/1998'),
('c', '9/10/1995', '12/31/2002'),
('c', '10/9/1996', '12/31/2000')
Thanks
Rich PRich
It is unclear what you are trying to achieve, you said that it is SQL Server 2000 but provide a sample data with SQL Server 2008 syntax
Is it possible to use UNION ALL for your queries to make its one
select * from
select * from #tmp2 t1 where exists
(select * from (select top 1 * from #tmp2 t2 where t2.fk = t1.fk order by t2.startdate) x where x.rowID = t1.rowID)
UNION ALL
select * from #tmp2 t1 where exists
(select * from (select top 1 * from #tmp2 t2 where t2.fk = t1.fk order by t2.Enddate desc) x where x.rowID = t1.rowID)
as der order by fk
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 -
DTS Import of MDB in SQL Server 2000 Drops Memo Field Data
I have used DTS in SQL Server 2000 to import an MDB filed (MS ACCESS) of a table. When the table is imported the primary key is lost and the memo field data is completely gone.
I use the tranformation option in the DTS wizard to add the primary key and make sure the data type for the memo field is varchar and has a size of 8000. I need that large size since I am storing lots of html code.
When I preview the data I see the html code that is supposed to get imported. However, when I return all rows from the table in Enterprise Manager the field is empty.
So I tried to manually copy the data from the MS Access Database into SQL Server. Could not figure out if SQL Server has an interface like MS Access to simply copy data into a table. So I linked to the tables from MS Access to the SQL Server table.
When I opened the linked table I see the data in the description field. However, if I return the rows from within SQL Server no data is present.
I have some ASP code trying to read the data in the SQL Server table. However, nothing is returned and when I run the SQL Statement, nothing gets returned. The SQL statement returns all rows. All the other data is present but nothing in the description field.
What am I doing wrong? Any suggestions anyone, please!
TIAIt is important to know the version of MS Access. I will recomend you to use nvarchar datatype instead of varchar. May be the description field contain unicode characters.
Refer this link to understand more on datatype mapping between access source and sql server destionation.
http://blogs.msdn.com/b/ssma/archive/2011/03/06/access-to-sql-server-migration-understanding-data-type-conversions.aspx?Redirected=true
Regards, RSingh -
How to load decimal values into a file using bcp in SQL Server 2000?
Hi everyone,
I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
Here are the DDLs and DMLs of what I'm trying to run:
CREATE TABLE [dbo].[Product_Sales](
[Year_of_Sale] [smallint] NOT NULL,
[Product_Type] [varchar](25) NOT NULL,
[Product_Group] [varchar](25) NOT NULL,
[Category_Type] [varchar](25) NOT NULL,
[Category_Group] [varchar](10) NOT NULL,
[Product_Count] [bigint] NOT NULL,
[Product_Amount] [decimal](19, 2) NOT NULL,
[Category_Count] [bigint] NOT NULL,
[Category_Amount] [decimal](19, 2) NOT NULL,
CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
[Year_of_Sale] ASC,
[Product_Type] ASC,
[Product_Group] ASC,
[Category_Type] ASC,
[Category_Group] ASC
) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
And the output I see in the file is:
2010 Online Web Cameras Electronics 547 .00 0 .00
The values before decimals are being truncated.
Thanks,
Bangaaram
Known is a DROP, Unknown is an OCEAN.You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
alter table [dbo].[Product_Sales]
Alter column [Product_Amount] varchar(20)
alter table [dbo].[Product_Sales]
Alter column [Category_Amount] varchar(20)
Does that make any sense?
Known is a DROP, Unknown is an OCEAN.
Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
Known is a DROP, Unknown is an OCEAN. -
Urgent: Finding sessions in SQL server 2000
Hi,
Can you help me how to find out sessions in SQL Server 2000.
Also is there any way to see the outstanding sessions for a database?
Thanks in advance,
Vasu.You can do this graphically in Enterprise Manager, or you can use this script:
SET NOCOUNT ON
create table #ProcCheck(
Status varchar(50) ,
SPID int ,
CPU int ,
Pys_IO int ,
WaitTime int ,
BlockSPID int ,
HostName varchar(36) ,
ProgName varchar(100) ,
NTUser varchar(50) ,
LoginTime datetime ,
LastBatch datetime ,
OpenTrans int ,
LastCmd varchar(4000))
create table #ProcInfo(
EventType varchar(100) ,
Parameters int ,
EventInfo varchar(7000)
INSERT INTO #ProcCheck(Status, SPID, CPU, Pys_IO, WaitTime, BlockSPID, HostName, ProgName, NTUSer, LoginTime, LastBatch, OpenTrans)
SELECT status, SPID, CPU, Physical_IO, WaitTime, Blocked, SUBSTRING(HostName, 1, 36), SUBSTRING(Program_Name, 1, 100), SUBSTRING(nt_username, 1, 50), Login_Time, Last_Batch, Open_Tran
FROM master..sysprocesses
where (blocked > 0
or spid in (select blocked from master..sysprocesses (NOLOCK) where blocked > 0)
or open_tran > 0)
and SPID <> @@SPID
declare @spid int ,
@cmd varchar(7000)
declare Procs cursor fast_forward for
SELECT SPID FROM #ProcCheck
OPEN Procs
FETCH NEXT FROM Procs INTO @SPID
WHILE @@FETCH_STATUS = 0
BEGIN
SET @cmd = 'DBCC INPUTBUFFER(' + CONVERT(varchar, @SPID) + ')'
INSERT INTO #ProcInfo
EXEC(@cmd)
SELECT @cmd = EventInfo
FROM #ProcInfo
DELETE FROM #ProcInfo
UPDATE #ProcCheck
SET LastCmd = SUBSTRING(@cmd, 1, 500)
WHERE SPID = @SPID
FETCH NEXT FROM Procs INTO @SPID
END
CLOSE Procs
DEALLOCATE Procs
SELECT * FROM #ProcCheck
DROP TABLE #ProcCheck
DROP TABLE #ProcInfo -
Storing and retrieving arabic in SQL Server 2000
hello, i realize this problem has been posted lots before but i read in the forum and i couldn't find a solution to fix my problem
i am developing a desktop application in java and sql server 2000, and i'm using JBuilder for writing my java codes
here's the problem
i can MANUALLY store arabic text in my database (directly in SQL Sever Query Analyzer) and can read it in arabic properly in SQL Server, but if i want to retrieve the arabic text in a query in JAVA, for example: select * from person i see weird characters (not question marks) but not the original arabic text
and if i type arabic text in a java textfield and use the value entered in an sql query, for example:
sqlQuery = "insert into person (fname) values ('" + jtfFName.getText() + "')";it is inserted in SQL Server as ?????s and when i retrieve the values from the table i also see it as ?????s
even when i converted all the data types in the database to unicode data types (*nchar* instead of char and nvarchar instead of varchar) and modified the sql query to the following:
sqlQuery = "insert into person (fname) values (N'" + jtfFName.getText() + "')";(N outside the single quotation mark since according to rules on msdn)
it still didn't solve the problem
please i need urgent help with this issue!problem was solved by setting the charSet encoding to "UTF-8" in the connection to sql server using the jdbc-odbc bridge
-
Using Unicode with MS-SQL-Server 2000
Hello,
i want to migrate my coldfusion application to support
unicode. for that i read some articles here in the knowledge bas e
and on the web. So i actually tested with:
* correct use of cfcontent,cfprocessingdirective
* storing source-files with UTF8 (BOM)
* activating Unicode-handling for strings in
datasource-settings of coldfusion admin
* using nvarchar instead of varchar on mssql-server
my firsts test displaying diffrent characters of different
languages (chinese, japanese, arabic) look good. Tests storing and
selecting example strings in that languages also look good.
but now i read, that mssql stores unicode data with the UCS-2
implementation and cannot handle UTF-8 directly. but my
coldfusion-application will be converted to UTF-8.
now my question: Do i have to do special handling storing and
selecting the application data or does this the mssql jdbc driver
for me. What about characters in some languages which use 3 Bytes
in UTF8. How are they handled when MS-SQL-Server 2000 uses UCS-2
(max 2 Bytes) instead?
Many regards for your answers
McDmcd wrote:
> now my question: Do i have to do special handling
storing and selecting the
> application data or does this the mssql jdbc driver for
me. What about
> characters in some languages which use 3 Bytes in UTF8.
How are they handled
> when MS-SQL-Server 2000 uses UCS-2 (max 2 Bytes)
instead?
no need to worry, the db driver will handle that for you.
just make sure your
encoding is the same end-to-end.
also a potential gotcha has just been exposed in unicode
handling for sql server
related to cfqueryparam under loads, you need to convert
everything to "N"
datatypes to avoid this. see jochem's blog:
http://jochem.vandieten.net/2008/03/22/ms-sql-server-and-the-coldfusion-string-format-sett ing/ -
SQL Server 2000 database GETDATE() default for field
I have a SQL Server 2000 database where the createDate field
has a default value of GETDATE() and the data type is datetime. It
is inserting the date just fine, but I do not want to capture the
time along with the date. I only want the date to be entered. How
can I accomplish this? Thanks!IF you only wanted to store the date, then yes you would use
that as the column default value.
createDate datetime default convert(datetime,
convert(varchar, getDate(), 102), 102)
However, as paross1 cautioned be sure you understand you will
only be capturing the date from now on. If you change your mind
later, and decide you need both the created date and time, you will
be seriously out of luck. A safer choice might be to keep the date
and time, and use convert in your queries instead. -
SQL Server 2000 Driver for JDBC
I am trying to learn how to connect to SQL Server 2000 and I keep getting errors. I have set my classpath and read through the online books, but I can't fix it. I'm not sure if I'm missing something in the configuration, or at the database level. Here are the errors I'm getting followed by my code: By the way, is there a limit on how long the classpath can be?
C:\j2sdkP>java TableMaker
Exception in thread "main" java.lang.NoClassDefFoundError: com/microsoft/jdbc/ba
se/BaseDriver
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:130)
at TableMaker.registerDriver(TableMaker.java:34)
at TableMaker.<init>(TableMaker.java:22)
at TableMaker.main(TableMaker.java:77)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
public class TableMaker
static String jdbcDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
static String dbName = "Contacts";
static String SQLCreate =
"Create Table Contact_Info (" +
"Contact_ID Integer Not null Primary Key, " +
"First_Name Varchar(20) Not null," +
"MI Char(1) Null," +
"Last_Name Varchar(30) Not null," +
"Street varchar(50) Not null," +
"City varchar(30) Not null," +
"State Char(2) Not null," +
"Zip varchar(10) Not null," +
public TableMaker()
registerDriver();
public void setDatabaseName( String dbName )
this.dbName=dbName;
public void registerDriver()
try {
Class.forName( jdbcDriver );
catch ( ClassNotFoundException e ){
System.err.println(e.getMessage());
public void execute( String SQLCommand )
Connection con = null;
Statement stmt = null;
try {
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433","test","test"); // test is both login and password
stmt = con.createStatement();
stmt.execute(SQLCommand);
con.close();
catch(Exception e) {
System.err.println(e.getMessage());
finally {
try {
if (con != null)
con.close();
if (stmt != null)
stmt.close();
catch (Exception ex) { }
public static void main(String[] args)
TableMaker tableMaker = new TableMaker();
tableMaker.execute(SQLCreate);
}Finally, I fix the problem! Can't put white space after ";" for CLASSPATH!!! for instance classpath=.; c:\..\*.jar doesn't work! it must be classpath=.;c:\..\*.jar The stupid JAVA!!! Thanks a lot.
I have another problem, right now I can connect to SQL Server 2000 from standalone program, but I can't connect to my DB from servlet.
ie. the following codes works for standalone program. but it doesn't work for servlet. Any help will be appreciated!
// Make sure the JdbcOdbcDriver class is loaded
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
// Try to connect to a database via ODBC
conn = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://127.0.01:1433", "sa",""); -
SQL Server 2000 "Yukon" architecture
Hi,
could you tell me whether Microsoft have achieved cluster technology with "Yukon" or not?
As announced in article: Database Architecture: Federated vs. Clustered-An Oracle White Paper March2002, "...According to Michael Otey, Senior Technical Editor, SQL Server Magazine:�Technically, this setup isn�t a true clustered implementation. According to Microsoft, SQL Server won�t support true clustering until the post-SQL Server 2000 release, code named Yukon.�(Yukon is not expected to be shipped until well into 2003.) - But when I browse msdn, there is nothing on the architecture itself.
I am doing my Master's thesis on 9iRAC, and I need this information to complete my research. I found several Oracle white papers talking about federated vs. clustered architecture. As said in Response to "Reality behind Real
Application Clusters Marketing Messages"- An Oracle White Paper March, 2003"..when in truth Microsoft does not have a cluster database." Is this still the truth? Can somebody from ORACLE provide me with tips/links to complete this topic?
I am also Oracle DBA, Oracle customer, registered on Metalink.
Thank you for the support.BOL 2014: "
Data Types (Transact-SQL)
SQL Server 2014
Data Type Categories
Exact Numerics
bigint
numeric
bit
smallint
decimal
smallmoney
int
tinyint
money
Approximate Numerics
float
real
Date and Time
date
datetimeoffset
datetime2
smalldatetime
datetime
time
Character Strings
char
varchar
text
Unicode Character Strings
nchar
nvarchar
ntext
Binary Strings
binary
varbinary
image
Other Data Types
cursor
timestamp
hierarchyid
uniqueidentifier
sql_variant
xml
table
Spatial Types "
LINK: http://msdn.microsoft.com/en-us/library/ms187752.aspx
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
Store&read chinese characters in MS SQL server 2000 using Java
Hi,
I have a problem to store Chinese characters in MS SQL Server 2000, storing question marks(??????) instead of Chinese characters
I am using JSF framework, SUN APPLICATION Server 9.1 , MS SQL Server 2000 server and Microsoft data source driver class (com.microsoft.sqlserver.jdbc.SQLServerDataSource) to connect db.
I have one solution:
IN JSP:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
and
In database column type should nvarchar in place of varchar
while inserting or updating the same need to add N prefix with the value like insert into client(Name, Id .) values (N+)
the above is working fine but the problem is here i have already defined database with 100s of tables I cant change database tables as well as queries
Thanks,
SathiI don't know any betterer option, than to copy the database tabels redefining the Chinese data fields as nvarchar.
To be frank I had also problems writing to a html file Chinese text stored in MS SQLServer 2000 nvarchar fields.
The following worked:'
public String getEncodedData(ResultSet resultSet, int columnIndex, String charset)
throws SQLException
//final String methodName = "getEncodedData";
InputStream binaryStream =resultSet.getBinaryStream(columnIndex);
String readStringFromStream=readStringFromStream(binaryStream, charset);//UTF_16LE);
return readStringFromStream;
public String readStringFromStream(InputStream inputStream, String charset) {
final String methodName = "readStringFromStream";
StringBuffer buffer = new StringBuffer();
try {
int ch;
InputStreamReader isr = new InputStreamReader(inputStream, charset);
Reader in = new BufferedReader(isr);
while ((ch = in.read()) > -1) {
buffer.append((char)ch);
in.close();
return buffer.toString();
} catch (IOException exception) {
Log.printError(this,methodName, exception);
return null;
}And writing it to file:
public void writeEncodedStringToFile(String text, String filePath, String charset, boolean append){
final String methodName = "writeEncodedStringToFile";
OutputStreamWriter writer= null;
try {
FileOutputStream fileOutputStream = new FileOutputStream(filePath, append);
writer = new OutputStreamWriter(fileOutputStream, charset);
writer.write(text);
} catch (IOException exception) {
Log.printError(this,methodName, exception);
}finally{
try {
writer.close();
} catch (IOException exception) {
Log.printError(this,methodName, exception);
}Edited by: astlanda on Feb 10, 2009 11:13 PM
Edited by: astlanda on Feb 10, 2009 11:21 PM -
Migrating Japanese Characters from MS SQL Server 2000 to Oracle 9i usng Jsp
Hi ,
I have a situation where the Japanese characters are to be migrated from MS SQL Server 2000 to Oracle 91 and then render the same using JSP.
I followed the below approach,
1. Extract the Japanese data from MS SQL Server and generate an XML
2. Parse the XML and store it into Oracle 9i database which is of UTF-8 encoding.
3. On retreiving and rendering using the Shift-JIS adds few junk characters additionally.
When I try to copy paste the Japanese contents from XML to a text file, it is working fine.
Could some one help me in resolving this issue?
It is very urgent, and any help would be greatly appreciated.There is documentation in the reference guide sent with the workbench, there is this discussion forum, the support web page (which includes tech notes and FAQ's), and the company specific procedural language documentation.
There is also an older document for use with the old sybase toolkits which may be obscelete, and there are some internal documents which were for internal consumption.
Turloch
Oracle Migration Workbench Team -
Hi guys,
Procedure
Homogeneous System Copy on SQL Server
Source Platform
Windows 2003 Server x86
SQL Server 2000 SP4
SQL_Latin1_General_CP850_BIN2
SAP R/3 4.7 x200
SAP Kernel 6.40 Patch 347 x86 (Sep 10 2010)
SAP_BASIS 620 Patch 69
Target Platform
Windows 2008 Server x64
SQL Server 2005 SP3
SQL_Latin1_General_CP850_BIN2
SAP R/3 4.7 x200
SAP Kernel 6.40 Patch 347 x64 (Sep 10 2010)
SAP_BASIS 620 Patch 69
Symptom
When running STM (SAP Tools for SQL Server) on the target server I get the following error:
- Errors when executing sql command: (Microsoft)(ODBC SQL Server Driver)(SQL Server)Could not find stored procedure u2018sap_use_var_MAXu2019.
Further Analysis
I'm able to start the SAP system.
Tx SICK returns the following:
- Wrong long datatypes. Perform SQL Server after upgrade steps. Please see note 126973
Troubleshooting
Note 126973 - SICK messages with MS SQL Server
Solution:
Proceed as described in Note 1291861
Note 1291861 - SICK message: Wrong long datatypes
2. If the problem occurred following a system copy from SQL Server 2000 to SQL Server 2005 or later then execute the following statements:
setuser 'sid'
exec sap_use_var_MAX
Where 'sid' is the SAPSID of your system in lower case.
setuser 'dev'
exec sap_use_var_MAX
Msg 2812, Level 16, State 62, Line 2
Could not find stored procedure 'sap_use_var_MAX'.
Request
I'm thinking if any one of you is able to access an SAP system on SQL Server (2005 or other) with the above mentioned stored procedure present you could scipt it to a txt file and post it here in order for me to create it manually on my system.
I've checked several SAP Notes on this subject and none of them explains how to create this store procedure from scratch, they all just assume it's already there and tell you to execute it.
Thank you.
Bruno PereiraI was able to solve this issue just now the following way:
- A friend of mine scripted it to a file which I then used to create the sap_use_var_MAX on the target database.
Here is a copy of that file:
USE [<SID>]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [<sid>].[sap_use_var_MAX] as
begin
declare @tabname sysname
declare @colname sysname
declare @datatype sysname
declare @nullflag nvarchar(1)
declare @cmd nvarchar(1024)
declare @n_altered int
declare c cursor for
select t.TABLE_NAME,c.COLUMN_NAME,c.DATA_TYPE,
nullflag = substring(c.IS_NULLABLE,1,1)
from INFORMATION_SCHEMA.COLUMNS c,
INFORMATION_SCHEMA.TABLES t
where c.TABLE_NAME = t.TABLE_NAME AND
c.TABLE_SCHEMA = t.TABLE_SCHEMA AND
t.TABLE_TYPE like '%TABLE%' AND
c.TABLE_SCHEMA = schema_name() AND
c.DATA_TYPE IN ('text','ntext','image')
order by t.TABLE_NAME,c.COLUMN_NAME
open c
set @n_altered = 0
fetch next from c into @tabname,@colname,@datatype,@nullflag
while (@@fetch_status <> -1)
begin
if (@@fetch_status <> -2)
begin
set @cmd = N'alter table [' + @tabname +
N'] alter column [' + @colname +
N'] '
if @datatype = N'text'
set @cmd = @cmd + N'varchar(MAX)'
else if @datatype = N'ntext'
set @cmd = @cmd + N'nvarchar(MAX)'
else
set @cmd = @cmd + N'varbinary(MAX)'
if @nullflag = N'N'
set @cmd = @cmd + ' NOT NULL'
else
set @cmd = @cmd + ' NULL'
-- print @cmd
exec( @cmd )
set @n_altered = @n_altered + 1
end
fetch next from c into @tabname,@colname,@datatype,@nullflag
end
close c
deallocate c
select convert(varchar,@n_altered) + N' columns were altered'
end -- sap_use_var_MAX
Mind you, you'll have to change <SID> and <sid> acoordingly, considering also if your db is dbo schema or sid schema owned!
Thank you for your help nonetheless!
Bruno Pereira
Maybe you are looking for
-
File Not Found Error: new WAR deployment
I'm trying to find the path to my new WAR deployed JSP files. The following error occurs: Exception: java.io.FileNotFoundException: d:\oracle\ora9ias_test\apache\apache\htdocs\RAP_Editor_viaWAR\RapView1_Browse.jsp In my address bar I type: http://(or
-
Where is my iPod's camera roll backup, and how can I get it back onto iPod
I was having trouble with my iPod Touch 5 and the new update of iTunes, 12.0.1.26. I digress here but this is why I hate updating iTunes, and now kinda hate Apple stuff in general, because every time I've updated iTunes in the past it's given me tro
-
TrackPoint buttons not working in Ubuntu on E540
I've installed Ubuntu 12.04 and WIndows 7 on my E540. In windows the additional buttons for the trackpoint located on the upper side of the touchpad work just fine. But in Ubuntu they don't work at all, is there additional software needed? I've alrea
-
An error occurred in lock management when attempting to set a lock on table
Hi All, I am getting the error 'An error occurred in lock management when attempting to set a lock on table SWWWIHEAD.' Sometimes the workitem is not created by the Workflow due to above error & this happens rarely but keeps coming. cany anyone guide
-
GRC 10.1 Simplified Access Request and Remediation View Issues
Hi Everyone, We recently upgraded our GRC 10.0 environment to 10.1, SP 5 and am having the following issues--has anyone else also experienced? In the simplified access request form, it keeps telling me to enter a "valid user ID"-even though the