|
Hi all,
I need to know whether SQL provides custom constraints??? i.e if i want to enforce a constraint on a Parent table given that its key is been referenced as a foriegn key in a child table, that it should have atleast one child???
Is it possible?????
When you fail to plan, you are planning to fail.
|
|
|
|
|
You can wrte triggers for the same. However it is not a good approach.
Better check in your stored procedure with the condition...
|
|
|
|
|
Hi,
I am new to SSIS. I have two different servers, one is AS400 and other in SQL server. There is one table ABC on AS400 and two table ABC and XYZ in SQL server. I need to take the join of the tables ABC (of AS400) and XYZ of SQL server and need to push the matching records into ABC table of SQL server.
Please advise me how can I achieve this in SSIS.
Thanks in Advance.
CodeManiac
xxxxxxxxxx
xxxxxxxxxx
|
|
|
|
|
|
Hi Abhijit,
Thanks for quick reply. But on clicking the link "This may help you", it redirects me to some where else and I do not have any registration there.
It would be great if you can post the solution here.
Thanks
CodeManiac
xxxxxxxxxx
xxxxxxxxxx
|
|
|
|
|
I really surprised to see the same thing happening with me. It was fine, when I was post the answer.
|
|
|
|
|
Hi Abhijit/CodeManiac,
Expert exchange displays the answers at the bottom when your referrer is Google. Try searching for the question title "Linking, Connecting MS SQL 2000 to AS400 Database" using Google, go to the first result, and scroll down to the bottom of page to view the replies.
Hope that helps.
Regards,
Syed Mehroz Alam
My Blog | My Articles
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein
|
|
|
|
|
One option could be, create multiple Data Source (one for AS400 and another for SQL Server) in your DataFlow task and then use Union All Data Flow transformation Item and set the output to one Data Destination that is your SQL Server.
|
|
|
|
|
Hi,
I have two identical databases whitch are different only by name (DB1 and DB2)
Eatch database is on one computer (PC1 and PC2) into a network.
Database DB1 contains table Tab1.
Database DB2 contains table Tab2.
The two tables Tab1 and Tab2 are identical as structure an receive the same data from an external aplication.
There are moments when the network is interrupted, from different causes and the two tables no longer contains the same data.
To synchronize the tables I have to copy only the rows which are lost from Tab1 in Tab2.
By a stored procedure i have to know which are the numbers of rows lost from Tab2 to fill in with rows from Tab1
I actually have to copy a number of lines from Tab1 in Tab2 with the condition to know which are the rows lost from Tab2.
Someone knows how can I do that? Thanks.
|
|
|
|
|
Hi
Do you rows have an unique identifier? If yes you could use something like this:
insert into tab2 select * from tab1 where not exists (select table2.id from tab2 as table2 where table2.id = tab1.id)
This will only work for added rows. Changing existing rows and synchronizing deleted rows will not work with this.
Regards
Sebastian
|
|
|
|
|
Use this:
Case 1
Insert into DB1.dbo.Table1 <br />
select * DB2.dbo.Table2 from where DB2.dbo.Table2.ID not in (select DB1.dbo.Table1.ID from DB1.dbo.Table1 )
Case 2:
Insert into DB2.dbo.Table2 <br />
select * DB1.dbo.Table1 from where DB1.dbo.Table1.ID not in (select DB2.dbo.Table2.ID from DB2.dbo.Table2)
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Thank you all.
The problem is that databases DB1 and DB2 are on different computers.
|
|
|
|
|
What brand are DB1 and DB2? If it's SQL Server, you could add a linked server[^]
|
|
|
|
|
|
Which database engine are you using. If you are using MS-SQL Server, it is fairly simple using linked server to keep both the dB in sync using some simple queries and statements...
|
|
|
|
|
Yes, DB1 is MSSQL 2005 and DB2 is MSSQL2000.
I haven't experience with "linked server"
Can you indicate some examples.
Thanks.
Regards,
Robert
|
|
|
|
|
|
|
hi..
I have created a sub report and want to put that sub report in the header of a report in the SQL Server Reporting Services.
How can i achieve this?
Pankaj
|
|
|
|
|
Why the header? Why not just put it into the body portion?
|
|
|
|
|
we can use sub reports in the body, but it will not show every page. If body is larger then it will continue in the second page and I have to show the header in every page. I do not want to design of header of every reports that's why I have created a sub report and want to put that sub report (header) in each and every report.
Pankaj
|
|
|
|
|
Hi All,
Hope you can help me with this one.
I'm receiving an error when trying to dbping a database on a server. I'm able to ping the server however. The error I receive is:
"SQL Anywhere Server Ping Utility Version 10.0.1.3415
Ping database failed -- Specified database not found."
It's clear that it's telling me the database can't be found on the server specied, the problem is the database is on that server.
Has anyone got any ideas on how to overcome this issue?
The command I'm using is:
dbping -d -c "ENG=ServerName;DBN=DatadaseName;UID=UserID;PWD=Password"
Thanks,
Mel
|
|
|
|
|
Is it possible to truncate all tables without touching the constraints.
All the best
|
|
|
|
|
By truncate do you mean delete records, but not the table itself? If there are constraints (for example table CUSTOMERS, which has records in SALES by a customer ID) you would have to delete the records from the child table (in this case SALES) first, then delete from the parent (in this case CUSTOMERS).
I have had this issue at work where we want to delete something, so we have to start with the "smallest child" and work our way up. If it's something you plan to do frequently then just write a stored procedure for it so you can run when necessary.
|
|
|
|
|
I want truncate because it resets primary key identity as well.
Anyway I had some time to search on web and found a sp that drops the foreign keys, truncates the tables and re-creates them. It is very cleaverly written.
|
|
|
|