Wednesday, March 28, 2012
Need to Add Data that is checked on a separate table
trying to recreate some tables from an older program. I had to create
new keys, since the old data didn't use keys in the same way and I'm
having problems populating the new keys. I'll give you one abridged
example and see if anyone has any ideas.
The main table is Contracts, with a key of ContractNumber. There is
also a ContractCode. The table is related to DO table by
ContractNumber, but that wasn't used on the old system, so I have to
insert it. ContractCode was, but I can't figure out how to fill in
ContractNumber in DO by comparing the ContractCodes from the two
tables. As I said, I'm new to SQL, and here's the last query I tried,
again to no avail. Any help is appreciated.
INSERT DeliveryOrder (DeliveryOrder_ContractNo)
SELECT Contract_Number
FROM Contracts AS a INNER JOIN DeliveryOrder AS b
ON a.ContractCode = b.DeliveryOrderContractNamehi
you just need to update the DO table DeliveryOrder_ContractNO, So can not
use insert command.
look this ,maybe can get some help
---
create table Contracts(ContractNumber int,ContractCode nvarchar(20))
Create table DeliveryOrder(DeliveryOrder_ContractNO
int,DeliveryOrderContractName nvarchar(20))
insert into Contracts select 1,'CountryA'
union all select 2,'CountryB'
union all select 3,'CountryC'
union all select 4,'CountryD'
insert into DeliveryOrder select NULL,'CountryA'
union all select NULL,'CountryB'
union all select NULL,'CountryC'
union all select NULL,'CountryD'
select * from contracts
select * from DeliveryOrder
contracts table
--
ContractNumber ContractCode
1 CountryA
2 CountryB
3 CountryC
4 CountryD
--
DeliveryOrder table
--
DeliveryOrder_ContractNO DeliveryOrderContractName
NULL CountryA
NULL CountryB
NULL CountryC
NULL CountryD
Update DeliveryOrder set DeliveryOrder_ContractNO=
(
select a.ContractNumber from Contracts a
inner join DeliveryOrder b on b.DeliveryOrderContractName = a.ContractCode
where b.DeliveryOrderContractName = DeliveryOrder.DeliveryOrderContractName
)
select * from DeliveryOrder
drop table contracts
drop table DeliveryOrder
---
DeliveryOrder_ContractNO DeliveryOrderContractName
1 CountryA
2 CountryB
3 CountryC
4 CountryD
"DarkGalahad" wrote:
> Hi all, I hope I can make this understandable. I'm new to SQL and I'm
> trying to recreate some tables from an older program. I had to create
> new keys, since the old data didn't use keys in the same way and I'm
> having problems populating the new keys. I'll give you one abridged
> example and see if anyone has any ideas.
> The main table is Contracts, with a key of ContractNumber. There is
> also a ContractCode. The table is related to DO table by
> ContractNumber, but that wasn't used on the old system, so I have to
> insert it. ContractCode was, but I can't figure out how to fill in
> ContractNumber in DO by comparing the ContractCodes from the two
> tables. As I said, I'm new to SQL, and here's the last query I tried,
> again to no avail. Any help is appreciated.
> INSERT DeliveryOrder (DeliveryOrder_ContractNo)
> SELECT Contract_Number
> FROM Contracts AS a INNER JOIN DeliveryOrder AS b
> ON a.ContractCode = b.DeliveryOrderContractName
>
Need to access SQL Server 2000 tables
I am trying to write a java program that will connect to a SQL Server DB, run some queries, pull some data and try to find some trends in the data.
The problem is that I have a copy of the Database, but I don't have SQL Server. I have been given a backup copy of the database though (SQL Server 2000). I know that in addition to the JDBC driver for SQL Server 2000 I will need something else to be able to access the DB. They have stopped selling SQL Server 2000, also the software tends to be a little expensive.
Is there anything else that I can use that will allow me the functionality of being able to run queries and pull data from the DB using JDBC? Will installing MSDE allow me to do that? Or is there someother software that will allow me to do that? Or do I have no other option except installing SQL Server 2000?
Any help is greatly appreciated.
ThanksHi there,
Will you only be accessing the database for the purposes of reporting (i.e. you won't be changing data and then merging these changes into a master database from which the backup was taken)?
What I would recommend is that you don't use MSDE but you use SQL Server 2005 Express Edition. You can download it here:
Download SQL Server 2005 Express
NB. The download could be quite hefty as you might need to download the .NET Framework 2.0, SQL Server 2005 Express Edition database engine and the Management Studio.
You are able to restore SQL Server 2000 database backups to SQL Server 2005 so what you would do is:
1) Install SQL Server 2005 Express & Management Studio Express (see previous link)
2) Use Management Studio Express to restore the SQL Server 2000 backup (you can do this by creating a new database and then restoring your backup over the top)
3) Download and install the JDBC driver for SQL Server 2005 here:
Download JDBC Driver
4) Write your Java program as required
Well, OK, you don't have to use the JDBC driver as you could also use the JDBC-ODBC bridge which already comes with Java but I'd recommend you use the JDBC driver.
Hope that helps a bit, but sorry if it doesn't
|||Thanks a lot NateV,
I will be using the DB for reporting purposes. I won't be chaning any data on the backend ( no inserts or updates, just selects). I am going to try using SQL Server Express 05 and let you know if it worked.
Thanks Again
Friday, March 23, 2012
Need something faster than RS for programatic generation of reports...
invoices programatically with reporting services rs.render.
It was supposed to replace an old program that sent the invoices to a
dot matrix printer. This one sends to two very fast hp laserprinters.
Unfortunately, the rendering process of an EMF file in reporting
services is too slow (slower than the old program), so they have sent
me back to the drawing board to figure out another way to print to the
laser printers other than reporting services. Any one with a clue,
please let me know.
Thanks,
TrintAfter rendering the first page and therefore know the number of pages in the
report (StreamIDs.Length + 1 in VB) you could execute the render method in
separate threads for each of the remaining pages.
Also watch the MaxActiveReqForOneUser setting in your C:\Program
Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\RSReportServer.config file.
regards
Alan
"trint" wrote:
> I have been working on a program for quite some time that prints
> invoices programatically with reporting services rs.render.
> It was supposed to replace an old program that sent the invoices to a
> dot matrix printer. This one sends to two very fast hp laserprinters.
> Unfortunately, the rendering process of an EMF file in reporting
> services is too slow (slower than the old program), so they have sent
> me back to the drawing board to figure out another way to print to the
> laser printers other than reporting services. Any one with a clue,
> please let me know.
> Thanks,
> Trint
>
Wednesday, March 21, 2012
Need some help!
Yeah Right !!!
Hrummpphhh !
Need some help - new at sql server
i'm new at sql server programming and i need some help
first i developed a program with sql server with sql server developer edition and i want to create a demo of my application that has a setup when setup is executed, it setups necessary files to run ms sql server and my demo application
how can i do that ? is there a tutorial or smt like ...
and also i want to try my program at 5 client computer and a server but i cannot configure client computer. It does not see server computer
what can i do to to configure server and client ? is it possible with developer edition of mssql server ?
Thanx for your help
MeCeXrRefer to MSDN http://msdn.microsoft.com/sqlserver website for further refence and articles.
Wednesday, March 7, 2012
need ideas on how to approach this issue
All,
Need ideas on how to approach this I'm writing a c# program:
Have to compare account numbers in one table to account numbers in
another table and if they exist in the second table
The problem is the tables are in two separate databases (two different
physical places). One table in the ERP system and the other is in the
financial system.
table1 ERP system
table2 Financial system
1. Should I dump table 1 into dataset table, do the same with table
two. This way they are both in the same dataset then figure out how to
compare 1 to 2?
2. Do I dump table 1 into an array and iterate through the array
making sql calls (using a data reader) to see if the account numbers
exist in second table?
3. Put both tables in the arrays and hack away?
What do you consider a good approach or best practice?
Thanks in advance
RCThe fast way is to somehow get all the numbers in one location (on one
server). You can then execute a SQL statement that performs a JOIN or uses
WHERE EXISTS to determine which numbers match.
You could use DTS to get the data out. Or you could read them to a file
(from the one server) and then build insert statements to load the data into
a temp table (denoted by a # sign) on the other server -- against which you
would run the appropriate query.
--
Keith
"RC" <rick_castrejon@.email.com> wrote in message
news:1120869189.371998.244770@.g14g2000cwa.googlegroups.com...
> ----
> All,
> Need ideas on how to approach this I'm writing a c# program:
> Have to compare account numbers in one table to account numbers in
> another table and if they exist in the second table
> The problem is the tables are in two separate databases (two different
> physical places). One table in the ERP system and the other is in the
> financial system.
> table1 ERP system
> table2 Financial system
> 1. Should I dump table 1 into dataset table, do the same with table
> two. This way they are both in the same dataset then figure out how to
> compare 1 to 2?
> 2. Do I dump table 1 into an array and iterate through the array
> making sql calls (using a data reader) to see if the account numbers
> exist in second table?
> 3. Put both tables in the arrays and hack away?
> What do you consider a good approach or best practice?
> Thanks in advance
> RC
>