How to import SQL script into another

Hi folks,

I have a lot of scripts. I want one main script and import
other scripts into it and load with isql.

Please give me a example how to import script into another.

Thanks
Surya
0
Surya
1/6/2011 3:56:30 AM
sybase.ase.general 8655 articles. 0 followers. Follow

5 Replies
1050 Views

Similar Articles

[PageSpeed] 50

On Wed, 05 Jan 2011 19:56:30 -0800, Surya wrote:

> Hi folks,
> 
> I have a lot of scripts. I want one main script and import other scripts
> into it and load with isql.
> 
> Please give me a example how to import script into another.

isql doesn't support that sort of thing.
You'd have to build some sort of external "merge" tool (in perl, VB, etc)
that would parse and interpret your "import" directives and generate the
complete SQL script before feeding it to isql.

Michael


0
Michael
1/6/2011 5:54:12 AM
> On Wed, 05 Jan 2011 19:56:30 -0800, Surya wrote:
>
> > Hi folks,
> >
> > I have a lot of scripts. I want one main script and
> > import other scripts into it and load with isql.
> >
> > Please give me a example how to import script into
> another.
>
> isql doesn't support that sort of thing.
> You'd have to build some sort of external "merge" tool (in
> perl, VB, etc) that would parse and interpret your
> "import" directives and generate the complete SQL script
> before feeding it to isql.
>
> Michael
>
>

Thanks Michael
0
Surya
1/6/2011 7:23:50 AM
Hi Surya,

We use the DOS copy command to combine all our scripts into one like the 
example below...
copy *.* all_my_scripts.sql

hth,
Mark

On 1/5/2011 10:56 PM, Surya wrote:
> Hi folks,
>
> I have a lot of scripts. I want one main script and import
> other scripts into it and load with isql.
>
> Please give me a example how to import script into another.
>
> Thanks
> Surya
0
Mark
1/6/2011 12:53:50 PM
You'll need to be a lot more specific ... OS (windows? unix/linux?) ...  type of 'scripts' (OS/shell scripts?  SQL 
scripts? something else?) ... at what point are you trying to import your scripts and into what?  (loading into an isql 
session?  pulling from a stored proc/batch that's already been forwarded to the dataserver? something else?)

In the meantime ... assuming unix/linux command line access, using isql, and access to a SQL script called test.sql, the 
following works for me:

=====================
$ cat test.sql
select  @@servername,
         getdate(),
         "hi, I'm a SQL script",
         @@trancount,
         @@spid

$ isql -SCC1 -Usa -P
1> :r test.sql
7> go		<-- notice the jump in line numbers

  ------------------------------ -------------------------- -------------------- ----------- ------
  CC1                                   Jan  6 2011  3:09PM hi, I'm a SQL script           0     26

(1 row affected)

1> exit

$ isql -v

Sybase CTISQL Utility/15.0/P-EBF16299 ESD #16/PC Intel/BUILD1500-112/OPT/Sun Oct 12 23:01:12 2008
.... snip ...
=====================

This feature could be used in a shell script, eg:

=====================
$ cat test.ksh

#!/bin/ksh

DSQUERY=CC1
SYBUSER=sa
SYBPWD=
myscript=test.sql

isql -S${DSQUERY} -U${SYBUSER} -P${SYBPWD} -w1000 <<-EOF
:r ${myscript}
go
EOF

$ test.ksh

  ------------------------------ -------------------------- -------------------- ----------- ------
  CC1                                   Jan  6 2011  3:14PM hi, I'm a SQL script           0     37

(1 row affected)
=====================



Surya wrote:
> Hi folks,
> 
> I have a lot of scripts. I want one main script and import
> other scripts into it and load with isql.
> 
> Please give me a example how to import script into another.
> 
> Thanks
> Surya
0
Mark
1/6/2011 8:15:53 PM
in unix... i'll ocationally do the following to handle multiple scripts...

for i in `ls *.sql`
do echo $i; isql -U -P-S -i $i -o $i.out;done

The -i is the inputfile and -o is the outputfile.


-- 
Cory Sane
[TeamSybase]
Certified Sybase Associate DBA for ASE 15.0
"Surya" wrote in message news:4d253d6e.6ecb.1681692777@sybase.com...
> Hi folks,
> 
> I have a lot of scripts. I want one main script and import
> other scripts into it and load with isql.
> 
> Please give me a example how to import script into another.
> 
> Thanks
> Surya
0
Cory
1/7/2011 3:49:32 AM
Reply:

Similar Artilces:

calling a sql script from another sql script
Hi, does anyone know how to call a sql script (Note: not a stored procedure) from another sql script in sybase? In oracle, you just put @ before the script name. I haven't been able to find out how to do it in sybase. Any help will be greatly appreciated. -Yilin Yilin Cai wrote: > > Hi, does anyone know how to call a sql script (Note: not a stored > procedure) from > another sql script in sybase? In oracle, you just put @ before the > script name. > I haven't been able to find out how to do it in sybase. Any help will be > greatly > app...

Syntax to call a t-sql script from another t-sql script
I need to know how to call a t-sql script from another t-sql script. In Oracle I can add a line: @tce_load_company.sql to a sql command file, and it will run that file. This allows me to have a single "master" file that has all of my lower level table initialization values. What is the syntax for doing this in SQLServer? Thanks, Chris Emerson "Christopher A. Emerson" wrote: > I need to know how to call a t-sql script from another t-sql script. > > In Oracle I can add a line: @tce_load_company.sql to a sql command file, and it > will r...

GENERAL SQL SERVER: Question about the Script that setups the SQL Server Database.
This is the first time I have created a script for Sql Server 2000, and I have run into a few syntax ereas that I am not familar with. Bellow is a section of the script from the Portal server packages. At the end of the sample, is "ON [PRIMARY], Can anyone explain to me what this does and why the primary key isnt setup inside the code itself? I am basically trying to take parts of the script and incorrporate it into my own script and hate added syntax that I dont understand, makes debugging a real pain in the future. CREATE TABLE [dbo].[Portal_Announcements] ( [ItemID] [in...

How To Import Records From One SQL Tbl To Another SQL Tbl In Same DB
Hello All, I need to import records from one SQL table to another SQL table. Both tables are in the same database. Does anyone know how? Thank you, Tina Well, you could use DTS, or you could use an INSERT queryINSERT INTO newTable (column1, column2, column3...) SELECT column1, column2, column3... FROM oldTable TerriTerri MortonEngagement Manager, NeudesicHow to ask a question tmorton, I tried using DTS and got confused. I got the query to work. Thank You! Tina...

Importing SQL script to the server database using SQL Management Studio
How do i import an sql script to the server using sql management studio? Can someone advise?  I'm not sure I understand your question. Are you trying to create a stored procedure?Please mark the post(s) that have helped you as "Answer"I'm better at brewing beer than crafting code but I have to do the latter to do the former. Will code for malt. Hi, Do you want to open and execute the “.sql” file in SQL Server Management Studio?If I have misunderstood, please let me know. In the SQL Server Management Studio, click File -> Open -> File…, choose the “.sql” fi...

How can i import records from a sql server table in project1 to another sql server table in project2
Hi, i have a table with all employee bio-data in a completed project. Iam now working on another project with a table that needs the same data and here iam talking about 300 records that rarely change. Instead of re-entering this data in this new table, i want to import the data from the completed project into a table in this new project. Does any one have any idea how to achieve that or is there a better option to do the same. One more thing iam realising here is that iam going to use this same data in very many applications and some one from one department is going to ...

Another SQL script question.
Hey all, How do i make sure that the local machine aspnet user account has privilages after installing my sql script on a local machine. ( this script gets run during my vb.net setup project. ) i was thinking about adding the user to the sql script its self. but i am unsure how to do this. if anyone could help i would be greatly appreciative. TIA -Chris-I am one of those! Check out this link. The link is for MSDE but applies to Sql Server too. It shows the syntax for adding new users to a database server and granting them access to specific databases. Thanks for you rep...

Import into PDM model from sql script
Hello I am trying to import a new table into my .pdm model from a SQL script. I got the impression that I could use reverse engineering from script in PD8 to do this. When doing so I can see that something is going on and PD8 finally tells me that the reverse engineering was a succes - but I cant see anything in the model diagram. What do I do wrong ? Any suggestion will be appreciated. Best regards Flemming First, there are 2 ways to reverse engineer (RE). One is from File->Reverse Engineer. This will create a new model. The other is from Database->Reverse E...

Importing a script into SQL Server Express
I am having trouble importing a database script into SQL Server Express. The script is from the Web Applications book from the Microsoft MCSD exams. My installation of SQL Server Express appears to be fine as I can login and create/delete databases through it. When I attempt to import the database script I get a variety of errors as follows:Msg 911, Level 16, State 1, Server ORTHANC\SQLEXPRESS, Line 1Could not locate entry in sysdatabases for database 'Contacts'. No entry found with that name. Make sure that the name is entered correctly.Msg 15401, Level 16, State 1, Server ORTHANC\SQLEXPRES...

ImportExport.aspx will import to sql locally on sql express but when I upload it to my host it does not import
I have this ImportExport.aspx control http://www.codeproject.com/KB/aspnet/ImportExportCSV.aspx and it works great locally. When I upload it to my host I keep getting this error. Cannot find table 0. Error importing. Please try again It will export just fine. I am able to export a sql table to a csv so I do not beleive its my appsettings but here they are just in case<add key="connsql" value="server=sql394.mysite4now.com;database=mtgowarbots;Trusted_Connection=false;uid=users;password=KibblesNBits" /> <add key="connmsa" value="Provider=...

SQL Remote ASE
hi did anybody know when SQL Remote support blob (image, text) replicacion for ASE - ASE? our company need this feature. joan caceres electro sur este s.a.a. Hello Joan, Support for image and text replication with SQL Remote went in as of ASA 6 mainline, 6.0.01.1256, and SA maintenance 5.5.04 build 1938. Regards, Bob Bauer Sybase Technical Support jmcd wrote: > hi > > did anybody know when SQL Remote support blob (image, text) replicacion for > ASE - ASE? > > our company need this feature. > > joan caceres > electro sur este ...

Problem importing SQL Anywhere to ASE on Linux
Hello to all, we are using a SQL Anywhere database Vs.5.5 on NT4.0. Now I want to test Sybase Adaptive Server Enterprise on linux. I have the database exportet (data and structure) and tried to import the sql scripts to ASE over isql. But that doesn't work because of syntax errors like comments that in sqlanywhere begins with a % sign and in ASE is a syntax used like in C. That is easy to correct but is ASE no so powerfull as sqlanywhere like user defined datatypes etc.? Is ASE totally different from sqlanywhere or is there a way to import this database in ASE. I hope there is a...

sql-remote between ASE and ASE
hello! sql-remote document don't give us help with replication with ASE and ASE. i need detail how to do it. i use ASE12 + NT4.0 + SQL Remote6.0.2 . i test it in the list 1�� define messagetype : smtp 2�� define use_name :one is publisher,the other is remote user_name 3�� define publisher,publication,subscription 4��execute ssremote.exe to receive or send message I failed at the step of extract database .i don't extract the database . please help me ,tell me the datail of sql-remote confige. Thanks a lot , ...

sql remote ase to ase
can I use sql remote ro replicate data form ase to ase or only from asa to ase and asa to asa ? I would also recommend that you read over the following tech doc; Implementing ASE to ASE Server SQL Remote Replication http://my.sybase.com/detail?id=1009730 Ian Bater iAnywhere Solutions Reg Domaratzki wrote: > Just be aware of the limitations pointed out in the documentation when using ASE as a remote database. > > Replication and Synchronization Guide > PART 4. Appendixes > APPENDIX A. Enterprise and Anywhere: Differences > > Limitations ...

Web resources about - How to import SQL script into another - sybase.ase.general

Critic's Notebook: Tina Fey, Amy Poehler and Bruce Springsteen Bring Holiday ...
Hollywood Reporter Critic's Notebook: Tina Fey, Amy Poehler and Bruce Springsteen Bring Holiday ... Hollywood Reporter Maya Rudolph sang and ...

Terrorist Tashfeen Malik’s Visa Application ‘Sloppily Handled:’ Congressman
Tashfeen Malik, one of the terrorists in the San Bernardino shooting, got into the U.S. partially thanks to a “sloppily handled” visa application, ...

National Herald case: Hours before Gandhis arrive, Patiala Court turns into a fortress
Almost twenty matters that where listed to be heard on Saturday have been deferred and have been given different dates.

Shots fired in busy Wisconsin mall, police say
NBCNews.com Shots fired in busy Wisconsin mall, police say KERO 23ABC News Copyright 2014 Scripps Media, Inc. All rights reserved. This material ...

Longest-serving Lebanese prisoner in Israel killed in Syria
BEIRUT (AP) — Samir Kantar, a Lebanese who was convicted of carrying out one of the most notorious attacks in Israeli history and spent nearly ...

South China Sea- Other countries shouldn’t meddle: Chinese envoy
BJP general secretary Ram Madhav and Chinese ambassador Le Yucheng shared opposing views on the contentious issue of South China Sea on Saturday. ...

Old Trafford legend: Why Leicester remind me of great Man United sides - Football - Premier League Transfer ...
OLD TRAFFORD great Andy Cole says table-toppers Leicester remind him of the Manchester United...

Auburn Deputy Mayor Salim Mehajer to be charged with electoral fraud offences
Controversial Auburn City Council Deputy Mayor Salim Mehajer is served with a court attendance notice for alleged electoral fraud offences.

Introducing 2015’s Miss World Winner: Miss Spain, Mireia Lalaguna Royo
Miss World winner 2015 is Mireia Lalaguna Royo, who won the title of Miss Spain before competing in the global competition. She is a 23-year-old ...

Community mourns football player, 15, who died shielding girls from gunfire
FOXSports.com Community mourns football player, 15, who died shielding girls from gunfire FOXSports.com KNOXVILLE, Tenn. A high school football ...

Resources last updated: 12/20/2015 10:22:45 AM