[dba-SQLServer] SQL Server linked to Teradata

Asger Blond ab-mi at post3.tele.dk
Tue Mar 24 17:32:57 CDT 2009


Ooops, ignore my answer. Didn't notice the subject line: "linked to
Teradata"...
Using sp_executesql of course only applies to SQL Server.
Don't know if Teradata has an equivalent sp.

Asger

-----Oprindelig meddelelse-----
Fra: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] På vegne af Asger Blond
Sendt: 24. marts 2009 22:05
Til: 'Discussion concerning MS SQL Server'
Emne: Re: [dba-SQLServer] SQL Server linked to Teradata

Mark,

A linked server does not directly support DDL-statements. But you can use
sp_executesql to submit a DDL-statement against the linked server. Like
this:

EXECUTE YourLinkedServer.YourDatabase.dbo.sp_executesql "CREATE TABLE
TestTable(TestColumn int)"

EXECUTE YourLinkedServer.YourDatabase.dbo.sp_executesql "DROP TABLE
TestTable"

Asger

-----Oprindelig meddelelse-----
Fra: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] På vegne af Mark A Matte
Sendt: 24. marts 2009 19:36
Til: dba-sqlserver at databaseadvisors.com
Emne: Re: [dba-SQLServer] SQL Server linked to Teradata


Thanks,

 

I have those...its just the CREATE and DROP syntax I can't seem to find.

 

Thanks,

 

Mark
 
> Date: Tue, 24 Mar 2009 11:01:18 -0700
> From: fhtapia at gmail.com
> To: dba-sqlserver at databaseadvisors.com
> Subject: Re: [dba-SQLServer] SQL Server linked to Teradata
> 
> Sorry, it's generally used as
> SELECT * FROM OPENQUERY(LinkServer, 'Select Field From Table')
> 
> or for Inserts
> 
> INSERT OPENQUERY(LinkServer, 'Select Field From Table')
> Values('Value')
> 
> DELETE OPENQUERY(LinkServer, 'Select Field From Table')
> 
> Etc...
> -Francisco
> http://sqlthis.blogspot.com | Tsql and More...
> 
> 
> On Tue, Mar 24, 2009 at 10:47 AM, Mark A Matte
<markamatte at hotmail.com>wrote:
> 
> >
> > Thanks Francisco,
> >
> >
> >
> > I get an error (from SQL Server) "Incorrect syntax near 'OpenQuery'"
> >
> > when I use: OpenQuery(LinkedServerName, 'Drop Table TableName')
> >
> >
> >
> > Any ideas?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Mark
> >
> >
> >
> > > Date: Tue, 24 Mar 2009 10:24:10 -0700
> > > From: fhtapia at gmail.com
> > > To: dba-sqlserver at databaseadvisors.com
> > > Subject: Re: [dba-SQLServer] SQL Server linked to Teradata
> > >
> > > you should be able to execute any number of the Teradata's commands by
> > > issuing the command via OpenQuery
> > > It will be constructed as such: OpenQuery(LinkedServerName, 'Drop
Table
> > > TableName') or what ever the command is for TeraData (sorry I am not
as
> > > familiar with this engine so I cannot help).
> > >
> > >
> > >
> > > -Francisco
> > > http://sqlthis.blogspot.com | Tsql and More...
> > >
> > >
> > > On Tue, Mar 24, 2009 at 7:25 AM, Mark A Matte <markamatte at hotmail.com
> > >wrote:
> > >
> > > >
> > > >
> > > > Hello All,
> > > >
> > > >
> > > >
> > > > I have successfully linked SQL Server2005 to Teradata. I can pull
data
> > > > from...and insert records into Teradata.
> > > >
> > > >
> > > >
> > > > I have NOT been able to create or drop a table in Teradata from SQL
> > Server.
> > > >
> > > >
> > > >
> > > > Can anyone help with syntax ( or if even possible)...or what
> > approach???
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > >
> > > >
> > > > Mark A. Matte
> > > >
> > > > _________________________________________________________________
> > > > Internet Explorer 8 – Now Available. Faster, safer, easier.
> > > > http://clk.atdmt.com/MRT/go/141323790/direct/01/
> > > > _______________________________________________
> > > > dba-SQLServer mailing list
> > > > dba-SQLServer at databaseadvisors.com
> > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > > http://www.databaseadvisors.com
> > > >
> > > >
> > > _______________________________________________
> > > dba-SQLServer mailing list
> > > dba-SQLServer at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > http://www.databaseadvisors.com
> > >
> >
> > _________________________________________________________________
> > Express your personality in color! Preview and select themes for
Hotmail®.
> >
> >
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX
_WL_HM_express_032009#colortheme
> > _______________________________________________
> > dba-SQLServer mailing list
> > dba-SQLServer at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > http://www.databaseadvisors.com
> >
> >
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 

_________________________________________________________________
Internet Explorer 8 – Now Available. Faster, safer, easier.
http://clk.atdmt.com/MRT/go/141323790/direct/01/
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com



_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com






More information about the dba-SQLServer mailing list