Copying database table with data
Dear Team,
I want to copy a database table with all entries of that table. example: if i am copying MARA table as ZMARA i want all the entries of MARA should also exist in ZMARA.
Is it possible to do this without writing any piece of code.
Regards,
N.Jain
Hi,
It is not possible to do the same without coding.
Regards,
Sriram
Edited by: Srirama Murthy Maddirala on Jun 4, 2008 11:14 AM
Similar Messages
-
How to enter values to a database table with data type 'LCHR'?
Hello All,
I have created a database table with five fields, of which the last field is 'Value' field in which i have to enter text with a maximum of 1000characters. I have also specified a 'Length' field preceding the 'Value' field.
The datatype specified for the 'Length' field is 'INT2' and for the value field is 'LCHR' with length 1000.
When i tried inserting values to the table through a report, the report is giving an error that 'Literals that take up more than one line are not permitted', which means 255characters.
Also, when i entered a short text which is less than 250 characters to the 'Value' field,, the report is working fine and the table entry is visible.
Can anyone help me in this?
It would be really helpful if you explain how to use 'LCHR' data type in tables and how to enter values to such a field with more than 255characters.
Thanks in Advance,
ShinoHi shino,
Alternatively,
you can use STRING instead of LCHR.
I too have tried with LCHR and am facing the same issue.. i am not sure why its coming..
i have tried STRING and its working perfectly.
wa-key_field = 'IN4'.
CONCATENATE 'Long text over 200 chars length '
'another Long text over 200 chars length '
'another Long text over 200 chars length '
INTO wa-long_text.
wa-len = strlen( wa-long_text ).
INSERT zshino_table from wa.
SELECT * FROM zshino_table INTO table it.
clear wa.
LOOP AT it INTO wa.
WRITE:/ wa-len, ' ' , wa-long_text.
ENDLOOP.
Also, remember to set the type of the database field as String.
hope this was of some help,
thanks and regards,
Sagar. -
Function Module To Copy Abap tables with data
Hi,
Is there an easy way to copy abap tables with the data to another destination table using function modules or sample codes?What do you mean for "destination"? Another SAP system e.g. an RFC destination?
And what kind of table do you need to copy? Ztables? Standard Tables?
If you mean Standard Tables, your task isn't a safe procedure. -
Please follow the scenario:
using C#
1) current database file name is DB20122013.
when user click on new year button
2)Create backup copy of current database
3)New database should create with all table(excluding table "Dailytemp" and "DailyMain") with data and database name as DB20132014.
Musakkhir Sayyed.Hi,
I hope, below stored procedure is useful for your scenario.
CREATE PROC Create_New_Database
( @DBNAME VARCHAR(550)
)AS
Test : Exec [Create_New_Database] @DBNAME='DB20122013'
BEGIN TRY
SET NOCOUNT ON
DECLARE @sql VARCHAR(MAX), @DBNAME_NEW VARCHAR(550),@num int
IF EXISTS(SELECT 1 FROM sys.databases WHERE name=@DBNAME) AND ISNUMERIC(RIGHT(@DBNAME,4))=1
BEGIN
SELECT @num= RIGHT(@DBNAME,4)
SELECT @DBNAME_NEW='DB'+CAST(@num AS VARCHAR(10))+''+CAST(@num+1 AS VARCHAR(10))
IF EXISTS(SELECT 1 FROM sys.databases WHERE name=@DBNAME_NEW)
BEGIN
SELECT @DBNAME_NEW+' database already exists'
END
ELSE
BEGIN
SET @sql='USE '+@DBNAME+' '+' backup database '+@DBNAME+' to disk = ''C:\'+@DBNAME+'.bak'' '
+' restore database '+@DBNAME_NEW+' from disk = ''C:\'+@DBNAME+'.bak'''
+' with move '''+@DBNAME+''' to ''C:\'+@DBNAME+'_data.mdf'' ,
move '''+@DBNAME+'_log'' to ''C:\'+@DBNAME+'_log.log'''
EXEC (@sql)
SET @sql=''
SET @sql=' USE '+@DBNAME_NEW+' IF EXISTS(SELECT 1 FROM SYS.TABLES WHERE NAME=''Dailytemp'')
BEGIN DROP TABLE Dailytemp END IF EXISTS(SELECT 1 FROM SYS.TABLES WHERE NAME=''DailyMain'')
BEGIN DROP TABLE DailyMain END '
EXEC (@sql)
END
END
ELSE
BEGIN
SELECT 'Database is now found or Database name does not mach the scenario'
END
SET NOCOUNT OFF
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000)
DECLARE @ErrorSeverity INT
DECLARE @ErrorState INT
SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(),@ErrorState = ERROR_STATE()
RAISERROR (@ErrorMessage,@ErrorSeverity,@ErrorState )
END CATCH;
GO
Regards,
RAMBHARATH -
How to move tables with data from one client to another
Hello friends
I have 2 clients 001 and 002.
I have created a table with lots of data on client 001.
I have to get the same table on 002 also with the same data.
Is there an easier way of transfering this data from one table to another?
I would appreciate any feedback on this.
I know that mappings etc., can be done using the export and import of tpz file. So I want to know if there is any similar thing to transfer a table with data.
THanks
Ramhi
thanks for the response
We are working on a sandbox system for demo purpose.
Actually we have two different group of people using two different clients created on the same server.
Our group is using client 001 and another group is using client 002.
We don't want the changes that one group does to the table to affect the other.
Our group has created a z-table and have entered considerable amount of data.
However, the other group also need to create the same table with the same data.
So to avoid double work, we were trying to see if there is a way to copy the table with data created on 001 to 002.
Any suggestions / feedback will be greatly appreciated.
Thanks
Ram -
How to Copy complete structure of a table with data from one database table to another databse table
I need a sql query to copy structure of table with data from production table of ONLINEBTREKDB database to production table of Archive database.
I tried this query
select * into Archive.dbo.Production from ONLINEBTREKDB.dbo.Production p
but problem is I am able to copy the table schema and data but not able to copy constraints(PK)
Any Help?
seemaYou've multiple options
1. Use generate scripts wizard available in SQL management studio. This is particularly helpful when you want to script out lot of objects. You can also choose to script data as well inside this. This can be launched by right clicking the db, choosing tasks
-> generate scripts and then selecting required options inside the wizard
2. Use object explorer and right click and script out table. You can also use search functionality to find object you want inside object explorer
http://visakhm.blogspot.in/2013/02/object-filtering-using-ssms-object.html
3. Use query based on INFORMATION_SCHEMA views like TABLES,COLUMNS,CONSTRAINT_COLUMN_USAGE etc to generate the script
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Help on export sybase iq tables with data and import in another database ?
Help on export Sybase iq 16 tables with data and import into another database ?
Hi Nilesh,
If you have table/index create commands (DDLs), you can create them in Developper and import data using one of methods below
Extract/ Load table
Insert location method : require IQ servers to be entered in interfaces file
Backup/Restore : copy entire database content
If you have not the DDLs, you can generate them using IQ cockpit or SCC.
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01773.1604/doc/html/san1288042631955.html
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01840.1604/doc/html/san1281564927196.html
Regards,
Tayeb. -
What is the best wayt to copy tables with data from development to Prod?
Dear all,
We have Oracle tables with data in a development server, I would like to know if there is any ‘easy’ and ‘direct’ way to copy them to the production server.
As I think import and export would be the best way. Any other althernatives?
Thanks.There are a number of methods you could use.
<ul><li>
Export and import would work or their 10g+ equivalents data pump. </li>
<li>You could create a database link between the 2 databases and use SQL*Plus copy to transfer data on a table by table basis (probably quite laborious unless there's only a few tables). </li>
<li>You could use transportable tablespaces (there are some restirctions - check the documentation http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/tspaces013.htm#sthref1632) </li>
<li>You could use RMAN to clone the development database (assuming the prod database hasn't been used yet and that there's nothing in it you need to keep).</li>
<li>You could create the prod database as a standby copy of the dev database </li>
</ul>
Using transportable tablespaces would be much faster than using data pump or import/export depending on how much data there is. -
Select data from database tables with high performance
hi all,
how to select data from different database tables with high performance.
im using for all entries instead of inner joins, even though burden on data base tables is going very high ( 90 % in se30)
hw to increase the performance.
kindly, reply.
thnksAlso Check you are not using open sql much like distict order by group by , use abap techniques on internal table to acive the same.
also Dont use select endselect.
if possible use up to n rows claus....
taht will limit the data base hits.
also dont run select in siode any loops.
i guess these are some of the trics oyu can use to avoid frequent DATA BASE HITS AND ABVOID THE DATA BASE LAOD. -
Sample report for filling the database table with test data .
Hi ,
Can anyone provide me sample report for filling the database table with test data ?
Thanks ,
Abhi.hi
the code
data : itab type table of Z6731_DEPTDETAIL,
wa type Z6731_DEPTDETAIL.
wa-DEPT_ID = 'z897hkjh'.
wa-DESCRIPTION = 'computer'.
append wa to itab.
wa-DEPT_ID = 'z897hkjhd'.
wa-DESCRIPTION = 'computer'.
append wa to itab.
loop at itab into wa.
insert z6731_DEPTDETAIL from wa.
endloop.
rewards if helpful -
Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.The Oracle documentation has a good overview of the options available
Generating XML Data from the Database
Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
You can also find some information in XML DB FAQ -
How to pass internal table with data in ABAP OO
Hi experts ,
Here is the problem...
I create a screen 100 and use the internal table to get data from database, and then press the button on screen 100 , it will call screen 200.
I use ABAP OO code in screen 200, and i want to keep the internal table with data that i get from the sceen 100 parts, but it seems that it just supports to create a new internal table and get data from database in ABAP OO. That means i need to create a new table to save the data in internal table ? Or there is any other solution something like exporting or memory id ...
ps . the internal table in screen 100 is declared in global area, the beginning of the code.
Please give me some advice, thanks a lot!
Regards ,
ClaireI have already know how to do, here is my code:
METHODS fill_tree importing itab2 like itab1.
CALL METHOD: me->fill_tree exporting itab2 = itab1.
In METHOD fill_tree,
declare
data: itab3 TYPE STANDARD TABLE OF itab,
itab3[] = itab1[].
It is useful to me, thanks a lot. -
Database table with potentially millions of records
Hello,
We want to keep track of user's transaction history from the performance database. The workload statistics contain the user transaction history information, however since the workload performance statistics are intended for temporary purposes and data from these tables are deleted every few months, we loose all the user's historical records.
We want to keep track of the following in a table that we can query later:
User ID - Length 12
Transaction - Length 20
Date - Length 8
With over 20,000 end users in production this can translate into thousands of records to be inserted into this table daily.
What is the best way to store this type of information? Is there a specific table type that is designed for storing massive data quantity? Also, over time (few years) this table can grow into millions or hundreds of millions of records. How can we manage that in terms of performance and storage space?
If anyone has worked with database tables with very large amounts of records, and would like to share your experiences, please let us know how we could/should structure this function in our environment.
Best Regards.Hi SS
Alternatively, you can use a <u>cluster table</u>. For more help refer to F1 help on <b>"IMPORT TO / EXPORT FROM DATABASE"</b> statements.
Or you can store data as a <u>file</u> on the application server using <b>"OPEN DATASET, TRANSFER, CLOSE DATASET"</b> statements.
You can also select to archieve data of older than some definite date.
You can also mix your alternatives for the recent and archieve data.
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
Moving tables with data from one client to another
Hello friends
I have 2 clients 001 and 002.
I have created a table with lots of data on client 001.
I have to get the same table on 002 also with the same data.
Is there an easier way of transfering this data from one table to another?
I would appreciate any feedback on this.
I know that mappings etc., can be done using the export and import of tpz file. So I want to know if there is any similar thing to transfer a table with data.
THanks
RamIf you do not have the client field in your table, then the table is cross-client.
IF you have the client field filled with 001, then you need to create the same entries with client 002, I dont think that you can do this with a transport.
You have to write an ABAP that reads and writes the data. -
Rename the existing table with date suffix
Hi,
I'm trying to rename a table with date suffix at the end of the table name, and drop the date suffix table which is greater than 7 days. for that I have the below sql, I have not included the drop syntax in this.
I'm not able to rename with the date suffix in the below sql, syntax error at '+'
DECLARE
@TPartitionDate date
IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'IIS_4')
BEGIN
SELECT
@TPartitionDate = MAX(PartitionDate)
FROM PartitionLog (NOLOCK)
EXEC sp_rename 'IIS_4','IIS_4_'+ @TPartitionDate
ENDcreate table Test(sno int)
DECLARE
@TPartitionDate date = getdate()
declare @a varchar(200)
IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'Test')
BEGIN
select @a='TEST_'+ cast(@TPartitionDate as varchar(10))
EXEC sp_rename 'TEST',@a
END
drop table [test_2015-04-23]
Hope it Helps!!
Maybe you are looking for
-
HT204382 Why can't I play a .MOV movie on my apple (MacBook Pro)?
My parents have been sending me little .MOV movies via email. But I can't play them on my MacBook Pro. I am however able to play them on my iPhone. Why can't I play it on my computer? This is the error msg I get: The document "IMG_0259.MOV" could not
-
I'm trying to download the iOS 5 and I get almost all the way done but then it stops when it's on Status and goes to an error and says "There is a problem with this windows Installer Package. A program run as part of the set up did not finish as exp
-
Why is the rendering process slowing right down?
Hi, I'm rendering a 4 minute clip of Pro Res LT files, there's a few effect on it but right now I'm only rendering the video at 1/4 quality. It starts rendering fine. Then starts to slow down, and by the time it gets to about 99.35%, it takes hours t
-
Does anyone can help me to import XML string into a ORACLE database
Hi guys! i have some problem that my friend wants me to convert XML string to Oracle relational database which means. let's say, there is a table that a row has XML string. so table has XML string with varchar type. what my friend want me to do is, t
-
I downloaded Pirates of the carribean this afternoon but I can't add it to itunes. I've tried adding it to the games menu, dropping it to my ipod logo, and adding it to library, no luck. I've got the latest itunes and ipod software and my ipod is com