HI
I am trying to create a stored procedure which inputs data from an access db to an SQL DB. My code:
CREATE PROCEDURE s2_comms
@.DBpath varchar(50)
AS
EXEC sp_addlinkedserver 'TempS2commsServer', 'Access 97', 'Microsoft.Jet.OLEDB.4.0', @.DBpath
CREATE DATABASE S2comms
USE S2comms
select * into Codes from OPENQUERY(TempS2commsServer, 'SELECT * FROM Codes')
select * into comms from OPENQUERY(TempS2commsServer, 'SELECT * FROM comms')
EXEC sp_dropserver 'TempS2commsServer'
But it tells me:
a USE database statement is not allowed in a procedure or trigger.
i am new to sql and cant figure out how to get round this, any ideas?
thanks for any help.well if you are using SQL Server, just create a DTS package to do this, much easier. Then you can schedule it to run when ever.
Showing posts with label codecreate. Show all posts
Showing posts with label codecreate. Show all posts
Tuesday, March 20, 2012
Friday, February 24, 2012
creating master key sql 2005
Hi,
I've trying to create a master key in sql server express edition 2005. I'm
using the follow code:
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '2005Password'
when i run this, the XM send me the follow message error:
Incorrect syntax near 'master'
Where is my mistake?
Att,
Leandro CarvalhoSupport is found here:
http://communities.microsoft.com/ne...lcid=us
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Leandro Carvalho" <LeandroCarvalho@.discussions.microsoft.com> wrote in
message news:C4EA5452-D474-4D94-9576-7DF0DE6020C8@.microsoft.com...
> Hi,
> I've trying to create a master key in sql server express edition 2005. I'm
> using the follow code:
> CREATE MASTER KEY ENCRYPTION BY PASSWORD = '2005Password'
> when i run this, the XM send me the follow message error:
> Incorrect syntax near 'master'
> Where is my mistake?
> Att,
> Leandro Carvalho
>
I've trying to create a master key in sql server express edition 2005. I'm
using the follow code:
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '2005Password'
when i run this, the XM send me the follow message error:
Incorrect syntax near 'master'
Where is my mistake?
Att,
Leandro CarvalhoSupport is found here:
http://communities.microsoft.com/ne...lcid=us
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Leandro Carvalho" <LeandroCarvalho@.discussions.microsoft.com> wrote in
message news:C4EA5452-D474-4D94-9576-7DF0DE6020C8@.microsoft.com...
> Hi,
> I've trying to create a master key in sql server express edition 2005. I'm
> using the follow code:
> CREATE MASTER KEY ENCRYPTION BY PASSWORD = '2005Password'
> when i run this, the XM send me the follow message error:
> Incorrect syntax near 'master'
> Where is my mistake?
> Att,
> Leandro Carvalho
>
Subscribe to:
Posts (Atom)