Sql Storeprocedure Transfer From Local To Server

Mar 6, 2008

 Hi everyone,
I have a problem. The problem is my local database which I have to transfer from local to server. I can transfer all my table but I cant transfer my all Sp.
Please Somebody help me.What I can transfer all my database from local to server.
I real need help. 

View 3 Replies


ADVERTISEMENT

How Do I Transfer Tables From Remote SQL Database To Local MDF File?

May 7, 2008

Hi all,

Currently, my (small) intranet site is storing it's data on a remote SQL server. The danger with this, as has happened several times now, is that the application is twice as vulnerable; if either the webserver or the dataserver malfunctions or is unreachable, the application won't work.

I only recently discovered the possibility to use local database files (MDF files), and this seems like a much better solution for my site. But now I want to transfer the tables that are residing on the dataserver, to the MDF file. The database only contains tables. How do I handle this? I do not have access to the dataserver, only to a few databases that are residing on it. Is this possible using Visual Studio 2008? I have read about a "Bulk Copy Program" (bcp) which is included with SQL Server, but I cannot find a download for just that application.

Or is this totally not the way to go? I've discovered MDF files are a bit more problematic with concurrent connections; having tables open in Visual Studio results in "Site offline" or "Cannot open database" error messages on the website. Problems I've never had to deal with using SQL Server, but they are only minor problems.

Thanks,
Peter

View 3 Replies View Related

Script Task: How To Compare Files On FTP With Existing Files In Local Folder Before Transfer!

Apr 24, 2008

In the first step of my SSIS package I need to get files from FTP and dump it/them in a local directory, but it's more than that, the logic is like this:
1. If no file(s) found, stop executing and send email saying no file(s) found;
2. If file(s) found, then compare it/them with existing files in our archive folder; if file(s) already exist in archive folder, stop executing and send email saying file(s) already existed, if file(s) not in archive folder yet, then transfer it/them to the local directory for processing.

I know i have to use a script task to do this and i did some research and found examples for each of the above 2 steps and not both combined, so that's why I need some help here to get the logic incorporated right.

Thanks for the help in advance and i apologize for the long lines of code!

example for step 1:
----------------------------------------------------------------------------------------------------------

' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports Microsoft.VisualBasic.FileIO.FileSystem
Imports System.IO.FileSystemInfo

Public Class ScriptMain

' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.

Public Sub Main()

Dim cDataFileName As String
Dim cFileType As String
Dim cFileFlgVar As String
WriteVariable("SCFileFlg", False)
WriteVariable("OOFileFlg", False)
WriteVariable("INFileFlg", False)
WriteVariable("IAFileFlg", False)
WriteVariable("RCFileFlg", False)
cDataFileName = ReadVariable("DataFileName").ToString
cFileType = Left(Right(cDataFileName, 4), 2)
cFileFlgVar = cFileType.ToUpper + "FileFlg"
WriteVariable(cFileFlgVar, True)
Dts.TaskResult = Dts.Results.Success
End Sub
Private Sub WriteVariable(ByVal varName As String, ByVal varValue As Object)
Try
Dim vars As Variables
Dts.VariableDispenser.LockForWrite(varName)
Dts.VariableDispenser.GetVariables(vars)
Try
vars(varName).Value = varValue
Catch ex As Exception
Throw ex
Finally
vars.Unlock()
End Try
Catch ex As Exception
Throw ex
End Try
End Sub
Private Function ReadVariable(ByVal varName As String) As Object
Dim result As Object
Try
Dim vars As Variables
Dts.VariableDispenser.LockForRead(varName)
Dts.VariableDispenser.GetVariables(vars)
Try
result = vars(varName).Value
Catch ex As Exception
Throw ex
Finally
vars.Unlock()
End Try
Catch ex As Exception
Throw ex
End Try
Return result
End Function
End Class

example for step 2:
-------------------------------------------------------------------------------------------------------

' Microsoft SQL Server Integration Services Script Task

' Write scripts using Microsoft Visual Basic

' The ScriptMain class is the entry point of the Script Task.

Imports System

Imports System.Data

Imports System.Math

Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain

' The execution engine calls this method when the task executes.

' To access the object model, use the Dts object. Connections, variables, events,

' and logging features are available as static members of the Dts class.

' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.

'

' To open Code and Text Editor Help, press F1.

' To open Object Browser, press Ctrl+Alt+J.

Public Sub Main()

Try

'Create the connection to the ftp server

Dim cm As ConnectionManager = Dts.Connections.Add("FTP")

'Set the properties like username & password

cm.Properties("ServerName").SetValue(cm, "ftp.name.com")

cm.Properties("ServerUserName").SetValue(cm, "username")

cm.Properties("ServerPassword").SetValue(cm, "password")

cm.Properties("ServerPort").SetValue(cm, "21")

cm.Properties("Timeout").SetValue(cm, "0") 'The 0 setting will make it not timeout

cm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kb

cm.Properties("Retries").SetValue(cm, "1")

'create the FTP object that sends the files and pass it the connection created above.

Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))

'Connects to the ftp server

ftp.Connect()

'ftp.SetWorkingDirectory("..")

ftp.SetWorkingDirectory("directoryname")

Dim folderNames() As String

Dim fileNames() As String

ftp.GetListing(folderNames, fileNames)

Dim maxname As String = ""

For Each filename As String In fileNames

' whatever operation you need to do to find the correct file...

Next

Dim files(0) As String

files(0) = maxname

ftp.ReceiveFiles(files, "C: emp", True, True)

' Close the ftp connection

ftp.Close()





'Set the filename you retreive for use in data flow

Dts.Variables.Item("FILENAME").Value = maxname

Catch ex As Exception

Dts.TaskResult = Dts.Results.Failure

End Try

Dts.TaskResult = Dts.Results.Success

End Sub

End Class

View 16 Replies View Related

Local SQL Server Instances Not Showing Up On Local Servers Tab Of Management Studio Logon Screen

Oct 2, 2007

We have a 64-bit VM server running SQL Server 2005. The SQL Server on this particular VM server has 6 local instances installed. On the Management Studio logon screen I can type the full name of the local instance and connect to it, however if I press the drop down in the Server name field, choose Browse and select the Local Servers tab there is nothing listed under Database Engines.

Any idea why the 6 local instances don't show up under Database Engines? This is preventing me from installing a vendor application because their installer looks for local SQL Server instances on this server, but if SQL Server won't even show the local instances then the installer doesn't see them either.

Any help is greatly appreciated.

Thanks,
Craig

View 3 Replies View Related

Problem With StoreProcedure

Feb 5, 2008

I write a simple StoreProcedure, but it shows error: "Error converting data type nvarchar to float.", please help with thanks:
ALTER PROCEDURE dbo.getLastQID @lastQID nvarchar(50) OUTPUTAS SELECT @lastQID=Str(Max(QID))   FROM Questions   RETURN @lastQID 
 

View 19 Replies View Related

STOREPROCEDURE + ACTIVEX DLL

Aug 12, 2000

Hi there,
Can I be able to call a Activex DLL from Sp or from triggers.

Sachi
Looking for a answer..

View 1 Replies View Related

Call StoreProcedure But Does Not Return Value.

Apr 2, 2008

I try to run the storeprocedure to get retRandomCode.Value, but it returns no value.
 Using myConnection2 As New SqlConnection(connString)
 
myConnection2.Open()
 Dim myPuzzleCmd2 As New SqlCommand("GetRandomCode", myConnection2)
 
myPuzzleCmd2.CommandType = CommandType.StoredProcedure
 Dim retLengthParam As New SqlParameter("@Length", SqlDbType.TinyInt, 6)
retLengthParam.Direction = ParameterDirection.Input
 
myPuzzleCmd2.Parameters.Add(retLengthParam)
 Dim retRandomCode As New SqlParameter("@RandomCode", SqlDbType.VarChar, 30)
 
retRandomCode.Direction = ParameterDirection.Output
 
myPuzzleCmd2.Parameters.Add(retRandomCode)
 
Try
 Dim reader2 As SqlDataReader = myPuzzleCmd2.ExecuteReader()
 
myPuzzleCmd2.ExecuteNonQuery()Catch ex As Exception
 
 
 Response.Write("sp value : " & retRandomCode.Value)                       <----- no value
Dim iRandomCode(1) As StringReDim Preserve iRandomCode(1)
iRandomCode(1) = Convert.ToString(retRandomCode.Value)Session.Remove("RandomCode")
 
 HttpContext.Current.Session("RandomCode") = iRandomCode
 
myPuzzleCmd2 = Nothing
 
 
 
Finally
myConnection2.Close()
 
End Try
 
End Using
 

View 10 Replies View Related

Using A Storeprocedure In A Select Statement

Aug 10, 2004

Hi,
i would like to use a storeprocedure as the from clause for a select statement..

something like

select * from exec spGetData

which obviously doesn't work.. anybody know a way i can do this?

thanks
chris

View 6 Replies View Related

Storeprocedure Having Two Variables Having , Seperated Values

Mar 15, 2008

can u give me some idea how to make Sp who having two variables as a parameter having values seperated by ","
now thses vaues have to insert in to two tables tbColor .... colorname,product_id
                                                           and   tbSize.......sizename,product_id
thanksss 

View 11 Replies View Related

Exec Storeprocedure - Multiple Joins

May 5, 2008

Hi,I am written a store procedure that would access four tables and grab appropriate fields.. I am using JOIN functionality because it can have multiple rows. ( The goal is: )Step 1: User can search by ID  or MEMBER_ID or both .. grab all the data from mainTable based on the search. WORKS.Step 2: TABLE 2 (userTable table) get EMAIL for each record that was grabbed.. based on the ID. WORKS.Step 3: TABLE 3 and TABLE 4.. I am having some problems combing into the query.. how to add multiple JOINS… Is it safe? Please see below what data needs to be combined into the query.--Code works for Step 1 and 2.declare @ID varchar(20), @MEMBER_ID varchar(20) set @ID= null --testing data.. set @MEMBER_ID ='15552' –testing data.. Select MainTable.REFNO,MainTable.ID,mainTable.MEMBER_ID,userTable.EMAILFROM mainTableLEFT JOIN userTableON mainTable.ID = userTable.IDWhere (mainTable.ID = @ID  OR @ID IS NULL) and(mainTable.MEMBER_ID = @MEMBER_ID OR @MEMBER_ID IS NULL)TABLE 3:  (works by itself)SELECT  SR.COMPANY, SR.LOCATION_NOFROM    SI INNER JOIN  SR ON      SI.SR_ID = SR.SR_IDWHERE   SI.ID = MainTable.ID)ORDER BY SR.DATE_RECEIVED DESCTABLE 4:  (works by itself)I will be retrieving LOCATION_NO from SR table and comparing the value to the below query: for each record that was found in  the mainTable.select LOCATION_NAME from locationwhere LOCATION_NO= SR.LOCATION_NO       Please help me solve this.. Thank you  

View 5 Replies View Related

An Issue With Calling A Function From Storeprocedure.

May 9, 2008

This is an issue with calling a stored procedure, which calls a function.this input parameter of the function is a list nvarchar.where i am giving the input like : 1,2,3,4,8 here for the corresponding id's 1,2,3,4,8i wanna take all the details and displaying it ina crystal report........  CREATE FUNCTION iter$simple_intlist_to_tbl (@list nvarchar(MAX)) RETURNS @tbl TABLE (number int NOT NULL) ASBEGIN DECLARE @pos int, @nextpos int, @valuelen int SELECT @pos = 0, @nextpos = 1 WHILE @nextpos > 0 BEGIN SELECT @nextpos = charindex(',', @list, @pos + 1) SELECT @valuelen = CASE WHEN @nextpos > 0 THEN @nextpos ELSE len(@list) + 1 END - @pos - 1 INSERT @tbl (number) VALUES (convert(int, substring(@list, @pos + 1, @valuelen))) SELECT @pos = @nextpos END RETURNEND create proc [dbo].[Comparison](@ProductVersionID VarChar(50))asbeginselect PV.Productversionname, F.FeatureID, F.Title, F.description, F.Modifieddate,PVF.IsPresent, FG.Title from features F,ProductVersionFeatures PVF, productversion PV, Featuregroup FG where F.FeatureID = PVF.FeatureID and PVF.productversionid = PV.ProductVersionID and iter$simple_intlist_to_tbl(@ProductVersionID) i ON PVF.productversionid = i.numberendThis is my Storeprocedure, where i am calling a function in this stored procedure but when i am trying to execute the Sp, i am facing an error liek this :Msg 195, Level 15, State 10, Procedure Comparison, Line 4'iter$simple_intlist_to_tbl' is not a recognized built-in function name. can any body please help me why this is hapenig, how can i solve this issue  

View 11 Replies View Related

Not Able To Connect To The Local Database With (local) As Server Name

Jun 7, 2006

I am facing a problem in connecting to the local database with server name as (local).

I have installed SQL Server 2005 in my machine. When I try to connect to the SQL server with the server name as SUNILKUMAR I am able to connect but when I try to connect to the same server with the server name as (local) I am not able to connect. SUNILKUMAR is my machine name and SQL server is running locally.

if anyone can help me what is the problem in this case it is highly appriciated.

View 7 Replies View Related

Writing Storeprocedure For Change Data Load Operation

Apr 28, 2008

i am trying to write a store procedure which inserts data from flat file to table but i want to align the rows for data transformation, like which column should be transferred to which column on the existing table. can anyone help me with this..i know how to do it thru DTS or SSIS but just want it in script...

cheers
Derek

View 10 Replies View Related

Moving A SQL Server 2000 Database From A Local Drive To Another Local Drive

Jan 31, 2008

Being a very novice SQL Server administrator, I need to ask the experts a question.

How do I go about moving a database from 1 drive to another? The source drive (C is local to the server, but the target drive (E is on a Storage Area Network (SAN), although it is still a local drive for the server. I want to move the database from C: to E:. Can someone provide me with instructions?

Thanks,
Rick

View 4 Replies View Related

Failed To Generate A User Instance Of SQL Server Due To Failure In Retrieving The User's Local Application Data Path. Please Make Sure The User Has A Local User Profile On The Computer. The Connection Will Be Closed

Dec 7, 2006

This is my first time to deploy an asp.net2 web site. Everything is working fine on my local computer but when i published the web site on a remote computer i get the error "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed" (only in pages that try to access the database)
Help pleaseee

View 3 Replies View Related

Transfer Manager Does Not Transfer Stored Procedures

Oct 22, 1998

I am using transfer manager in SQL 6.5 to copy a database and
all objects with data to another server. Transfer manager is not recreating all stored procedures. This even happens when I used it to another database on the same server. Any ideas??

View 3 Replies View Related

Transfer Data To New Table Then Transfer Indexes

May 30, 2008

Is it possible/advisable when transfering very large amounts of data from server to server to:
trasnfer the data to a new table first
second alter new table adding indexes, defaults, ets based on original table

if it is what flow item would be used to transfer/alter the indexes and defaults?

I'm very new to ssis so the more detail you can give the better.

Thanks

View 5 Replies View Related

Need Help - Local Synchronization Between SQL Mobile And Local SQL Database

Dec 21, 2005

Hi Everyone

I am at the stage of architecting my solution

My goal is to develop the system on a windows application and pda

There is a central server which will create a publication called inventory

The laptops which host the windows application will be subscribers to the central server using merge replication

The client now wants the PDA using SQL Mobile to synchronize with the local subscirber database on the laptop using active sync. They dont want to do it via WIFI to the IIS Server at the central server

I have been reading for days and I am still unsure whether this is possible to do.

I know Appforge provide a conduit for palm to access synchronization but not local sql databases

I would appreciate your help immensley

View 7 Replies View Related

Transfer Manager Transfer Dying?

Feb 16, 1999

Hello:

I have been trying to run transfer manager to transfer all of the data
from the production database on one server to a test database on another
server(to refresh it). In order to make sure it runs on the server, I have
been scheduling it under EM to do so and I am pointing to the log on the
destination server on the EM Transfer panel.

For some reason, I am getting the following message in the destination
server error log:

99/02/16 10:24:41.42 ods Error : 17824, Severity: 10, State: 0
99/02/16 10:24:41.42 ods Unable to write to ListenOn connection
'.pipesqlquery', loginname 'sa', hostname 'TEMP09'.
99/02/16 10:24:41.42 ods OS Error : 232, The pipe is being closed.
99/02/16 10:24:41.42 spid17 Error : 1608, Severity: 21, State: 2
99/02/16 10:24:41.42 spid17 A network error was encountered while sending
results to the front end. Check the SQL Server errorlog for more
information.

I checked the event viewer error log and see no messages for today.

Can any one advise me what I need to do for this to run successfully?

Thanks. Any information furnished will be greatly appreciated.

David Spaisman

View 1 Replies View Related

Query Analyzer Error Unable To Connect Server Local Msg17, Level 16,state 1/ODBC SQL Server Driver [DBNETLIB]SQL Server Does Not

Oct 20, 2007

I am getteing
need help
Query analyzer error Unable to connect server local Msg17, level 16,state 1
ODBC SQL server driver [DBNETLIB]SQL server does not exist

View 6 Replies View Related

SQL Server Authentication Mode In 'Transfer SQL Server Objects Task' Gives Error

Nov 10, 2005

I was trying to transfer a SQL Server 2000 database  to SQL Server 2005 using SQL Server Objects Task. However, The following error message was encountered:   "[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "Cannot apply value null to property Login: Value cannot be null..".€œ  

View 12 Replies View Related

Error At Transfer Objects Task: The Source Server Can Not Be The Same As The Destination Server.

Jul 4, 2005

SQL Server 2005 - June CTP

View 7 Replies View Related

SQL 7.0 Transfer To Another Server

May 11, 2001

I have a corrupt master db due to a rogue script that inserted lots of information into it. I have two SQL servers, and I could use some advice on the best way to copy the files over to the second server, then back after a reload of the first server. My main concern is the DTS packages I have built- I can't afford to lose those.

View 4 Replies View Related

Transfer DB From One SQL 7 Server To Another

Jul 30, 2000

Hello. Firstly apologies for what might appear as a basic question, but being a newbie and all :-). .

I have a SQL 7 DB, loads of sp, vw, tables etc. I want to copy this DB to another server so that all the DB and sp permissions stay current, all the sql logins come across etc etc.

I have tried restoring a backup to the new server (which worked fine), but then I appear to have lost the permissions for the tables and sp's.

I have then tried taking a copy of the original SQL master table and restoring this to the new server - but no luck.

Can anyone advise a sure method of copying an entire table and related entries (meaning sql logins etc) to a new server.

Appreciate any comments.

Regards

View 3 Replies View Related

Transfer Db From Sql Server

Dec 13, 2007

What will be the best way to transfer database from sql to oracle server. I have almost 50 databases in sql, I dont want to create a dts for each and every database to transfer-- Is there a process to transfer entire database at one time

Josephine

Josephine

View 1 Replies View Related

Methods For Transfer Of Data From Sql Server 2000 To Sql Server 7

Nov 10, 2004

Hi

We are planning to upgrade from sql server 7 to sql server 2000.The sql server 2000 will be installed on another server.
If we have to move back from sql server 2000 to sql server 7 (if there are any problems on sql server 2000).is there a way to do it?
Is there a way to restore the changes made on sql server 2000 to 7?

Thanks

Madhukar

View 3 Replies View Related

Transfer Logins: The Source Server Can Not Be The Same As The Destination Server

Nov 30, 2005

I am replacing a server so I need to migrate everything. The old server is running SQL2000 and the new server is running SQL2005. I am trying to write an SSIS solution to migrate everything for me and I can't even get started because I get the error "The source server can not be the same as the destination server". At the same time I am changing the name of the Domain so the two machines arenot even members of the same Domain. I am doing this over the Internet so the machines are not even on the same subnet. The only thing I can think of is that the machine names are the same so even though the domains are different therefore the full names are different, the NetBIOS names are the same. Could that be the problem?

View 1 Replies View Related

Transfer Login: Source Server Can Not Be Same As Destination Server

Jul 3, 2007

Hi!



I have two servers. Server A and Server B Both the servers are in different domains and both have different names.



Server A runs a clustered sql server (sql 2005 standard sp1)



Server B also runs a clustered sql server (sql 2005 enterprise sp1)



Both server A and Server B has same virtual server name X.



So, when I try to copy all the logins from server A to Server B using Transfer Login task in ssis, I gert the following error-



"Source Server Can not be same as destination server"



I am using IP addresses to connect to both the servers.



How do i solve this issue now?



Thanks

View 1 Replies View Related

Transfer Db From MSDE To SQL Server

Dec 9, 2003

Hi

I think I must operate a similar system to the rest of you here, where I have a Shared SQL Server Database on the web for my website and since I cant afford the full SQL Server to develop on I'm developing on the MSDE that comes with VS.net(I think thats where I got it longtime ago). Anyway my point is since in the database project on VS.net I cant generate Create Table SQL Code against MSDE, Apparently you need the full SQL Server to do that. Whats the best way for me to transfer any changes from my dummy development database to my production database on a real SQL Server.

Any help would be appreciated I'm still rather new to SQL Server(been using cheap MySQL) so could do with some pointers.

Thanks

Andy

View 2 Replies View Related

Transfer Databases From One Server To Other

Sep 29, 2004

Hi,
I have several databases on one MSQL Server which I want to transfer to new server. So, basically it is tranferring all contents of sql server databases on one server to another one. I know I can use import Wizard, but it will take long time, is there a more better way to do this.

Thanks,
Mashro.

View 1 Replies View Related

Transfer Of DTS Packages To Another Server

Jul 23, 2001

We will migrate our SQL 7.0 databases into SQL 2000 on another server. Since I have hundreds of DTS packages on my Repository, is there a better way of transferring to the other server's Repository then ... Package -> Save As -> choose server and location etc,etc...?
Thanks, Suat.

View 1 Replies View Related

Database Transfer To New Server

Dec 5, 1999

Hi

I was wondering if any one out there could help me out here. We are using SQL Server 7.0, we have purchase a new server, what will be the best procedures to transfer the current database to the new server? I look forward to hearing from anyone, also I wish you all a Merry Christmas & Happy New Year.

I shall remain.

E. Warden

View 3 Replies View Related

Database Transfer From One Sql Server To Another

Dec 30, 1999

Hi,
I am new to the database concepts, maybe my questions are very basic.
I transfered data from one sql server to another thru object/database transfer. The transfer was successful, ie.,
all the data was present in the new server too. I am using an application with ASP as front end and SQL server 6.5 as back end.
So i am able to all new records, delete them, update them thru my ASP programs. But, i am not able to update the records
which where transfered from the old server. I hope some one of can help me, as i said earlier i am new to databases,
so give me a detailed solution.

Thanks,
Karthik narain

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved