|
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.
|
|
|
|
|
It can't be done simply, any table without an key can be truncated and use the following if there is a key
DELETE FROM TableName
DBCC CHECKIDENT (TableName, reseed, 1)
this will have the same effect as truncate. It will only work if there is no DATA based on the foriegn key, it will not violate the referential integrity of the data.
I have a script that will clean out a database but it is hard coded for each application. It truncates all the non key table and then walks the key structure of the database manually.
You could write a script/app that walked the FK structure of a database and created a hierarchy tree based on the keys (this is what code generators do)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I needed to reset identities as well so, deletion was not enough for me...
But at the end I found a good sp that makes all I need.
|
|
|
|
|
Hi
how can i set union constraint on a column using sql server management studion
|
|
|
|
|
|
Ebube wrote: set union constraint
Union contraint ?
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
CREATE PROCEDURE dbo.sp_GetNewestTemplates
AS
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'Joe Smith'
order by lastchange desc
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'Jane Smith'
order by lastchange desc
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'GI Jane'
order by lastchange desc
GO
WHY does that code give no errors but this does:
CREATE PROCEDURE dbo.sp_GetNewestTemplates
AS
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'Joe Smith'
order by lastchange desc
union
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'Jane Smith'
order by lastchange desc
union
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'GI Jane'
order by lastchange desc
GO
I need this to work! What am I missing, and how can I get around this ridiculously annoying error? All it says is "Error 156: Syntax error near union."
|
|
|
|
|
what error are you getting ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
What happens when you remove the ORDER BY ?
|
|
|
|
|
The syntax works, but I have 3 disjoint selections as a result. I am looking to save one of the pieces of data in each row to a variable in VB.NET, if you can tell me how to do that without the union of the 3 results then that is fine. At the moment I don't know how
|
|
|
|
|
The UNION concatenates the results, but you can use this result as if it were a query again, e.g.;
SELECT * FROM
(
SELECT TOP 1 [name] FROM sysobjects WHERE [name] LIKE ('sysh%')
UNION
SELECT TOP 2 [name] FROM sysobjects WHERE [name] LIKE ('sys%')
UNION
SELECT TOP 1 [name] FROM sysobjects WHERE [id] < 0
) AS myCTE ORDER BY [name]
|
|
|
|
|
You are specifying ORDER BY too many times. You do not need to specify ORDER BY for each of the sub-queries; you only need to specify it once for the entire UNION result set.
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'Joe Smith'
union
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'Jane Smith'
union
SELECT TOP 1 *
FROM TBL_SWBOM_CHECKLIST_TEMPLATES
WHERE TEMPLATEOWNER = 'GI Jane'
order by lastchange desc
|
|
|
|
|
For Joe Smith, I have multiple rows that I want only the row that has both the name (WHERE TEMPLATEOWNER = 'Joe Smith') AND the row where the LASTCHANGE is the newest. So that first select should return the newest entry by Joe Smith. Then the second and third selects should find the one row that is the most recently updated by Jane and GI.
The way it stands now, query analyzer shows three disjoint results. I need a joint record set. The removal of the order by in each select breaks the function.
|
|
|
|