My version of SQL server for the syntax near "on line 1 is what I mean? what it means?
What should I do when my computer tells me that there is a mistake in my SQL syntax?
Hello
Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited to the audience on MSDN. Please post your question in the below link:
http://social.msdn.Microsoft.com/forums/en-us/category/SQLServer
Tags: Windows
Similar Questions
-
Installation of SQL Server for the virtual Center Server
Hi all
We bought 16 x 2 for ESX server CPU licenses. So, I will prepare a database of virtual server of the Management Center 16 guests. As SQL Server 2005 Express is installed during installation of Virtual Center Server but VMware is recommended for use only for 5 guests.
So I would like to prepare a database of SQL for VC server, please help me how to make the database to the virtual Center Server. Are there special tables, configuration, permissions. I have no experience with databases then how should I go with it. Is there a guide for it. The ESX Server installation guide explains only create ODBC connections.
Please help me with this I would be very obliged.
I know that the procedure is restrited 2 steps (1 and 2) on page 68, but you need to install and configure SQL Server for your business standard (I guess asking the C: or D: and data/newspapers on E :). I'm not going to explain better how to install SQL Server on a server. For the SQL Server database:
Step 1: you create a database storing the files on the right disk (with at least 30 GB) with a default database size to the size defined by the "Calculator" (value of + 15% on the line of your choice statistical level).
Step 2: On your Microsoft SQL Server, create a user of SQL Server database with the database rights of operator (DBO). The default database for the DBO User is that you defined in step 1. Make sure the database user has a role of sysadmin server or the role of database db_ownerfixed on the VirtualCenter database and the MSDB database. The role db_owner on the MSDB database is required for the installation and upgradeonly. This role can be removed after installation or upgrade process iscompleted.
The user must be created for your standard business as service account (password never expires) with a long and complex password.
Other steps in the document are for the ODBC connection.
Creating the tables is made during the installation of VC. Nothing to do. A characteristic is not to stop the SQL Server agent because some tasks are scheduled in the database to 'compact' statistics.
For the record, the database is upgraded when installing patches VC creating of new tables, updating of data type or...
-
Hello
We install TMS v15 and we will use external SQL. What communication ports, protocols, and services that are required for communication between the server SQL and MSDS?
Thank you
LAN
Hello
As directed by installation of TMS external help SQL server guide, requirement of network latency between the Cisco TMS server and SQL server should not exceed 20 ms.
For the ports used by TMS refer to this guide on page 13.
For connections SQL, the TCP port used by an instance SQL server by default is configurable, and the port used by a named instance of SQL server is dynamic, changing whenever the service restarts.
For instructions on taking your SQL server server to listen on a particular port:
https://TechNet.Microsoft.com/en-us/library/ms177440.aspx
Kind regards
Acevirgil
-
Loading data to SQL server for the Oracle database
I want to create a table in oracle db table in sql server. Table is huge that he has obtained the documents 97,456,789.
I created the link (HS) db in the oracle database that points to the sql server. I choose this oracle db on the link table.
Select * from 'dbo '. "T1@dblink;
I shot below to create the table.
create table t2 nologging parallel (degree = 3) as select * from 'dbo '. "T1@dblink;
and its taking a long time... but its operation...
is there any other method to do this and and fill the table in oracle db faster.
Please notify. Thank you.vhiware wrote:
create table t2 nologging parallel (degree = 3) as select * from 'dbo '. "T1@dblink;
and its taking a long time... but its operation...I doubt that parallel processing will be used because it is unique to Oracle (using rowid varies in general) and not SQL-Server.
is there any other method to do this and and fill the table in oracle db faster.
Part of the performance overhead is to pull that data from SQL Server to Oracle in the whole of the liaison network between them. This can be accelerated by compressing the data first - and who then transfer them over the network.
For example: using + bcp + to export the data in the SQL Server box to a CSV file, compress/zip file, scp/sftp file Oracle and then to unzip there. In parallel and direct treatment of load can now be done using SQL * Loader to load the CSV file into Oracle.
If it is a basic Linux/Unix system, the process of decompression/unzip can be run in parallel with the SQL * process Loader by creating a pipe between the two – where the decompression process writes data uncompressed in the pipe and SQL * Loader reads and loads the data that is available through the pipe.
Otherwise you are PQ own transformation. Assume that the data is date varies. You can create a procedure on Oracle that looks like this:
{code}
create or replace procedure as copyday (day) is
Start
Insert / * + append * / into local_tab select * from remote_tab@remotedb where col_day = day;
-Add logging info, validation, etc.
end;
{code}You can now start 10 or more of these different days and run it in the background using DBMS_JOB.
-
Original title: how to solve this problem:
System error
You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5
Hi Roger,
It seems that you have problems with the SQL syntax. The question you have posted is related to encoding and it would be better suited to the MSDN Community. Please report it in the community below.
http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home
Hope this is useful.
-
I have a purchase order where my buyers can add to my form. I use a loop that adds an extra line when they add a new product. I'm storing the information in two tables different mySQL. The first is alll of my personal, the second is the elements. My personal records correctly. However, I get the following error when you save the items:
You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near 1, 'wer 2345', 1, 1)' on line 9
The error occurred in E:\webs\clarkwebhosting.com\SSL\esrc\order_add.cfm on line 74
++ After storage of the personal information, I take the command ID to populate the table of Articles
< cflock timeout = "5" >
< name cfquery = "qGetorderID" datasource = "#application.dsn #" >
Select max (orderID) as oid of orders
< / cfquery >
< / cflock >
< cfoutput > < cfset getoid = #qGetorderID.oid # > < / cfoutput >
++ Is the loop that I use to fill the table items ++
< cfloop to = "#form.numba # '1' = ' index 'idx' = >"
< cfset getqty = evaluate ("form.qty" & idx) >
< cfset getitem = evaluate ("form.item" & idx) >
< cfset getunit = evaluate ("form.unit" & idx) >
< cfset gettotal = evaluate ("form.total" & idx) >
< name cfquery = "insertItems" datasource = "#application.dsn #" >
INSERT in Articles
(orderID,
quantity,
agenda,
Unit,
total
)
VALUES)
< cfqueryparam value = "" #getoid # "CFSQLType ="CF_SQL_INTEGER">"
< cfqueryparam value = "" #getqty # "CFSQLType ="CF_SQL_INTEGER">,"
< cfqueryparam value = "" #getitem # "CFSQLType ="CF_SQL_VARCHAR">,"
< cfqueryparam value = "" #getunit # "CFSQLType ="CF_SQL_INTEGER">,"
< cfqueryparam value = "" #gettotal # "CFSQLType ="CF_SQL_INTEGER">"
)
< / cfquery >
< / cfloop >
This line: 1, 'wer' 2345, 1, 1 is the first element of the command line. Any ideas as to why it doesn't work? I use 5.5.9 - log CF9 and mySQL
My apologies... that should have been (note the quotes)...
In addition, it would be...
On another note... You should probably avoid using cfinput and simply use the standard form tags.
-
original title: SQL Server 2008
We have SQL Server 2005 cluster (3 node cluster) and if we improve this nodes to 2008 R2, can the databases associated with the named instance remain to the version of SQL Server 2005, I seem to disagree with this notion, but still need to validation of the pro.
One way I can think of to achieve this scenario changes the compatibility level to SQL Server 2005 when the node has been upgraded to SQL Server 2008, so we can upgrade databases to SQL 2008 as and when the vendors provide support for this version.
Hello
Here is the Vista forums
Try the links below:
SQL Server forums
http://social.technet.Microsoft.com/forums/en-us/category/SQLServer/
SQL Server TechCenter
http://TechNet.Microsoft.com/en-us/SQLServer/bb265254.aspx
Blogs and Forums SQL server 2008
http://www.Microsoft.com/sqlserver/2008/en/us/forums-blogs.aspx
-
What is the version of SQL Server Express embedded used?
To the best of my knowledge, we are using vCenter Server 5.0 U1.
Build number is 623373 in help | Everything.
What is the version of the SQL Server Express included/embedded - 2008?
How to know and check?
I need to know specifically which version of SQL Server Express Management Studio install on our vCenter server so I can start to run maintenance such as backups that truncates logs, and also to allow for more storage Journal, we get the error 9002 with the journal storage.
Thank you, Tom
vCenter Server 5.0 uses Microsoft SQL Server 2008 R2 Express as the Group datasbase.
See for example http://kb.vmware.com/kb/2003790
André
-
ODBC SQL Server for Solaris 64-bit drivers
Does anyone know if there is a driver available for ODBC SQL Server for Solaris 64 bit server?
Thank you
CB
[edit: moved to SQL Server questions]
Ask the question in the SQL Server forums:
http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer -
Hardware requirements for MS SQL Server for about 100 concurrent users
Can someone suggest the hardware configuration required for MS SQL Server for about 100 concurrent users?
Microsoft page suggests 2 GHz CPU and 4 GB of RAM, but it does not mention the number of users. Wonder how many users affects the performance of MS SQL.Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for Windows Server on MSDN. Please post your question in the MSDN Windows Server forum.
http://social.msdn.Microsoft.com/forums/en-us/category/SQLServer/
-
Windows 7 64 bit Pro connects to SQL Server on the Windows Server 2008 R2 Standard domain
I put upgraded to Windows 7 Professional computers to Windows XP Professional, but I have a problem with getting one of software programs management of stock that allows us to connect to our SQL Server 2008 R2 Standard Windows on new Windows 7 computers.
Our computers are connected to a domain, and therefore SQL Server. Computers Windows XP allows each user to standard domain to connect and to connect to SQL Server via the stock management software.
But on the standard domain of Windows 7 Pro computer users unable to connect to SQL Server, but administrator accounts of area on the same Windows 7 Pro computers can connect to SQL Server through the inventory control program.
I have set up the alias of the server, the server name and port number via the SQL Server Client Network utility (
cliconfg.exe
) so I know this isn't the problem because it works when I'm logged on as a domain administrator.There seems to be something to do with permissions of user domain and Windows 7 Pro. There seems to be a change from Windows XP Pro to Windows 7 Pro that does not allow standard domain users to connect to a SQL Server. But I can't find anything about and cannot practice how to solve this problem, except to make all users, domain administrators that is obviously not a good thing to do. So basically I think I need to create a group policy that allows users to connect to SQL Server, but I have no experience in doing this and don't know where to start.
Thank you for all that you guys help and I hope someone can give me the solution to this problem.
This issue is beyond the scope of this site and must be placed on Technet or MSDN
-
SQL Server compact: the filemay of the damaged database.
I get a Message at startup:
An error occurred initializing SQL server compact: the filemay of the damaged database. The dataabase file may be damaged. Run the repair utility to check the file daatabase. [Database Name = \\?\\C:\program data\DDN;\Oasis2service\data\oasis2.sdf].
Where can I find the repair utility?
Hello
Try asking in the Forums in SQL Server.
Here is the Vista Forums.
http://social.msdn.Microsoft.com/forums/en-us/category/SQLServer
See you soon.
-
I need to download the 32-bit version of the editor instead of the 64-bit version I downloaded earlier for the trial.
The 32-bit version will not download because I have other 32-bit Office programs on my computer... ideas?
When you register for the download, it should offer the possibility of either 32 or 64-bit:
Choose the 32-bit or 64 -bit version of Office - Publisher - Office.com
-
Single SQL query for the analysis of the date of customs declaration under the table of Stock codes
Dear all,
Please tell us a single SQL query for the below,
We have a Table of Stock as shown below,
STOCK_TABLE
ITEM_CODE
(item code)
BAT_NO
(lot no.)
TXN_CODE
(transaction code)
DOC_NO
(number)
BOE_DT
(date of the customs declaration)
I1
B1
I1
I2
I3
B70
I4
B80
I5
B90
T102
1234
JULY 2, 2015
I6
B100
We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).
For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.
- If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).
- If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.
- If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.
- If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
-
No VRM server registered with vCenter Server for the site 'Live '.
I have SRM 6.1 and vSphere replication 6.1 installed on both sites.
The ECP is connected to the vCenter server.
I get this error message: failed to create the protection group. No VRM server registered with vCenter Server for the site 'Live '.
Screenshot attached, no one knows what is happening here?
However, there was a mismatch in the meantime server on all except VRA in the remote site, it is now resolved and the issue disappeared.
Strange, how the error related to the site online, however.
Thank you for pointing me in the right direction.
HISTORY_TABLE
ITEM_CODE | BAT_NO |
TXN_CODE
DOC_NO
UPDT_DT
I1
B1
T1
1234
JANUARY 3, 2015
I1
B20
T20
4567
MARCH 3, 2015
I1
B30
T30
7890
FEBRUARY 5, 2015
I2
B40
T20
1234
JANUARY 1, 2015
TRANSACTION
TXN_CODE | TXN_TYPE |
T1 | IN |
T20 |
OFF
T30
ALL THE
T50
IN
T80
IN
T90
IN
T60
ALL THE
T70
ALL THE
T40
ALL THE
IN_TABLE_HEAD_1
H1_SYS_ID (primary key) | TXN_CODE | DOC_NO |
DOC_DATE
H1ID1
T1
1234
JANUARY 1, 2015
H1ID2
T70
1234
FEBRUARY 1, 2015
IN_TABLE_ITEM_1
I1_SYS_ID |
H1_SYS_ID
(foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)
ITEM_CODE
I1ID1
H1ID1
I1
I1ID2
H1ID1
I100
I1ID3
H1ID2
I3
IN_TABLE_BATCH_1
B1_SYS_ID | TXN_CODE DOC_NO (now in IN_TABLE_HEAD_1) | BAT_NO |
B1ID1
T1
1234
B1 / can be empty
B1ID2
T70
1234
B70
IN_TABLE_HEAD_2
H2_SYS_ID (primary key) | TXN_CODE |
DOC_NO
DOC_DATE
H2ID1
T30
4567
FEBRUARY 3, 2015
H2ID2
T60
1234
JANUARY 3, 2015
IN_TABLE_ITEM_2
I2_SYS_ID | H2_SYS_ID (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2) | ITEM_CODE |
I2ID1 | H2ID1 |
I1
I2ID2
H2ID1
I200
I2ID3
H2ID2
I2
IN_TABLE_BATCH_2
B2_SYS_ID |
I2_SYS_ID
(foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)
BAT_NO
B2ID1
I2ID1
B30 / null
B2ID2
I2ID2
B90
B2ID2
I2ID3
B60
IN_TABLE_HEAD_3
H3_SYS_ID (primary key) | TXN_CODE | DOC_NO | DOC_DATE |
H3ID1 |
T50
1234
JANUARY 2, 2015
H3ID2
T80
1234
JANUARY 3, 2015
H3ID3
T90
1234
JANUARY 4, 2015
H3ID4
T40
1234
AUGUST 5, 2015
IN_TABLE_ITEM_3
I3_SYS_ID |
H3_SYS_ID
(foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)
ITEM_CODE
BAT_NO
I3ID1
H31D1
I2
B50
I3ID2
H3ID2
I4
B40
I3ID3
H3ID3
I4
I3ID4
H3ID4
I6
There is no IN_TABLE_BATCH_3
Please find below the expected results.
OUTPUT
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO |
BOE_DT
BATCH_YN
I1
B1
T1
1234
JANUARY 3, 2015
THERE
I1
B30
T30
7890
FEBRUARY 5, 2015
N
I2
B60
T60
1234
JANUARY 3, 2015
N
I3
B70
T70
1234
FEBRUARY 1, 2015
THERE
I4
T90
1234
JANUARY 4, 2015
N
I6
T40
1234
AUGUST 5, 2015
N
Controls database to create the tables above and insert the records.
CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), boe_dt DATE );
INSERT EN stock_table
VALUES ('I1', 'B1', '', '', '');
INSERT EN stock_table
VALUES ('I1', '', '', '', '');
INSERT IN stock_table
VALUES ('I2', '', '', '', '');
INSERT EN stock_table
VALUES ('I3', 'B70', '', '', '');
INSERT EN stock_table
VALUES ('I4', 'B80', '', '', '');
INSERT EN stock_table
VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');
INSERT EN stock_table
VALUES ('I6', 'B100', '', '', '');
SELECT *
FROM stock_table
CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), updt_dt DATE );
INSERT IN history_table
VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');
INSERT IN history_table
VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');
INSERT IN history_table
VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');
INSERT IN history_table
VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');
SELECT *
FROM history_table
CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));
INSERT INTO transaction1
VALUES ('T1', 'IN');
INSERT INTO transaction1
VALUES ('T20', 'OUT');
INSERT INTO transaction1
VALUES ('T30', 'ALL');
INSERT INTO transaction1
VALUES ('T40', 'ALL');
INSERT INTO transaction1
VALUES ('T50', 'IN');
INSERT INTO transaction1
VALUES ('T60', 'ALL');
INSERT INTO transaction1
VALUES ('T70', 'ALL');
INSERT INTO transaction1
VALUES ('T80', 'IN');
INSERT INTO transaction1
VALUES ('T90', 'IN');
SELECT *
FROM transaction1
CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
INSERT IN in_table_head_1
VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');
INSERT IN in_table_head_1
VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');
CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,
h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,
h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,
h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),
bat_no VARCHAR2 (80));
INSERT IN in_table_item_1
VALUES ('I1ID1', 'H1ID1', 'I1');
INSERT IN in_table_item_1
VALUES ('I1ID2', 'H1ID1', 'I100');
INSERT IN in_table_item_1
VALUES ('I1ID3', 'H1ID2', 'I3');
INSERT IN in_table_item_2
VALUES ('I2ID1', 'H2ID1', 'I1');
INSERT IN in_table_item_2
VALUES ('I2ID2', 'H2ID1', 'I200');
INSERT IN in_table_item_2
VALUES ('I2ID3', 'H2ID2', 'I2');
INSERT IN in_table_item_3
VALUES ('I3ID1', 'H3ID1', 'I2','B50');
INSERT IN in_table_item_3
VALUES ('I3ID2', 'H3ID2', 'I4','B40');
INSERT IN in_table_item_3
VALUES ('I3ID3', 'H3ID3', 'I4','');
INSERT IN in_table_item_3
VALUES ('I3ID4', 'H3ID4', 'I6','');
SELECT *
FROM in_table_item_1
SELECT *
FROM in_table_item_2
SELECT *
FROM in_table_item_3
CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,
txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));
CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,
i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));
INSERT IN in_table_batch_1
VALUES ('B1ID1', 'T1', '1234', 'B1');
INSERT IN in_table_batch_1
VALUES ('B1ID2', 'T70', '1234', 'B70');
INSERT IN in_table_batch_2
VALUES ('B2ID1', 'I2ID1', 'B30');
INSERT IN in_table_batch_2
VALUES ('B2ID2', 'I2ID2', 'B90');
INSERT IN in_table_batch_2
VALUES ('B2ID3', 'I2ID3', 'B60');
Please advise a solution for the same.
Thank you and best regards,
Séverine Suresh
very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)
with
case_1 as
(select s.item_code,
s.bat_no,
h.txn_code,
h.doc_no,
h.updt_dt boe_dt,
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 1' '.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of w_stock_table
where bat_no is null
or txn_code is null
or doc_no is null
or boe_dt is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and s.bat_no = h.bat_no
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
),
case_2 as
(select s.item_code,
NVL (s.bat_no, h.bat_no) bat_no.
NVL (s.txn_code, h.txn_code) txn_code.
NVL (s.doc_no, h.doc_no) doc_no.
NVL (s.boe_dt, h.updt_dt) updt_dt.
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 2'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of case_1
where refers_to is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
and not exists (select null
of case_1
where item_code = h.item_code
and bat_no = h.bat_no
and txn_code = h.txn_code
and doc_no = h.doc_no
and updt_dt = h.updt_dt
)
),
case_31 as
(select s1.item_code,
NVL (S1.bat_no, W1.bat_no) bat_no.
NVL (S1.txn_code, W1.txn_code) txn_code.
NVL (S1.doc_no, W1.doc_no) doc_no.
NVL (S1.updt_dt, W1.doc_dt) updt_dt.
cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.
cases where w1.txn_code is not null
and w1.doc_no is not null
and w1.doc_dt is not null
then "case 31'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s1
left outer join
(select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no
of w_in_table_item_1 i1
inner join
w_in_table_head_1 h1
On i1.h1_sys_id = h1.h1_sys_id
inner join
w_in_table_batch_1 b1
On h1.txn_code = b1.txn_code
and h1.doc_no = b1.doc_no
) w1
On s1.item_code = w1.item_code
),
case_32 as
(select s2.item_code,
NVL (S2.bat_no, W2.bat_no) bat_no.
NVL (S2.txn_code, W2.txn_code) txn_code.
NVL (S2.doc_no, W2.doc_no) doc_no.
NVL (S2.updt_dt, W2.doc_dt) updt_dt.
cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.
cases where w2.txn_code is not null
and w2.doc_no is not null
and w2.doc_dt is not null
then "case 32'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s2
left outer join
(select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no
of w_in_table_item_2 i2
inner join
w_in_table_head_2 h2
On i2.h2_sys_id = h2.h2_sys_id
inner join
w_in_table_batch_2 b2
On i2.i2_sys_id = b2.i2_sys_id
) w2
On s2.item_code = w2.item_code
),
case_33 as
(select s3.item_code,
w3.bat_no,
NVL (S3.txn_code, w3.txn_code) txn_code.
NVL (S3.doc_no, w3.doc_no) doc_no.
NVL (S3.updt_dt, w3.doc_dt) updt_dt.
cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.
cases where w3.txn_code is not null
and w3.doc_no is not null
and w3.doc_dt is not null
then "case 33'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s3
left outer join
(select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no
of w_in_table_item_3 i3
inner join
w_in_table_head_3 h3
On i3.h3_sys_id = h3.h3_sys_id
) w3
On s3.item_code = w3.item_code
)
Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn
of case_1
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_2
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,
ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_31
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_32
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_33
where refers_to is not null
)
)
where rn = 1
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO | BOE_DT | BATCH_YN |
---|---|---|---|---|---|
I1 | B1 | T1 | 1234 | JANUARY 3, 2015 | THERE |
I1 | B30 | T30 | 7890 | FEBRUARY 5, 2015 | N |
I2 | B60 | T60 | 1234 | JANUARY 3, 2015 | N |
I3 | B70 | T70 | 1234 | FEBRUARY 1, 2015 | THERE |
I4 | - | T90 | 1234 | JANUARY 5, 2015 | N |
I6 | - | T40 | 1234 | AUGUST 5, 2015 | N |
Concerning
Etbin
Maybe you are looking for
-
How many devices can I connect to Apple Capsule 2 TB A1409
-
Hello just unboxed a new server HP ProLiant ML310e v2 Gen8 (8 GB of ram). I can reach the Web interface of the ILO, but the server hangs on initialization of the system windows 2012 beginning 90%. I try with RAID1 and RAID 0, I tested the raid with t
-
Why 2754670 KB MS works 9 continues to fail? Is there a solution? FixIt is not working.
-
use smart touch with motherboard screen fried.
I have a touchsmart 520-1055 who claimed due to motherboard problem. Anyone know if there is a way to connect to the screen to use as an additional display for an another touchsmart or any other computer besides. I've already removed the HD and RAM s
-
Recommedn a good camera backpack
I am looking into buying a backpack for my camera gear, since my Lowepro Nova 5 AW can get quite heavy when I'm on the bike, and I'd really rather not throw my stuff in the bag backpack that I already wear, so I thought I would just get one that is b