i am loading xml files present in a folder to sql server. i am doing this by means of ActiveX script (VB). i am passing every xml file and its schema definition file as parameter. later this script automatically create a table in script and loads the the data to database. for every xml in that foleder there is only one xsd.--------this was my intention.
but when i run the DTS script error is coming like "Error source: schema mapping, unable to upload xsd file".
is that always necessary to add
(xlmns:sql "urn:schemas-microsoft-com:mapping-schema") in its schema definition file.
i have tried to move upload of files from SQL2000 to SQl2005. in SQL2005 i have created a JOB in which has 2 steps,each one of them activates the same batch files i used in SQL2000 (where i have change the server name and so on),for example :
for %%f in ( %BULK_UPLOAD_BASE%Temp%1*.txt) do bcp "db1.dbo.Test_TargetTable" in %%f -S SERVER-REP -U n145 -h "TABLOCK" -e %BULK_UPLOAD_BASE%ErrorErr10.txt -o %BULK_UPLOAD_BASE%LogsOutput10.txt -P n145 -C RAW -f %BULK_UPLOAD_BASE%format_with_RawData_4test.fmt
when irun this code in a bat file, the data is loaded with no problem. when i run the JOB i see in the LOG that everything was ok, but actually the data fromthe files was not loaded - any idea why? thnaks in advance peleg
Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
I have to upload about a million records from a text file using DTS packages. The file has a predefined format which map to the fields in the database. Some of the fields width exceed the width in the database. Does that mean that it will truncate these fields, or will it fail the whole bulk upload?
I am rewritting our DTS that upload tables in FoxPro to SQL Server using SSIS. I am finding the that SSIS is way slower. My uploads using DTS take just 7 minutes where doing the same thing in SSIS is taking 1 hour 15 minutes.
I have to update a field within a table of 60 records or so. Each record has a different field value. it's type varchar. i was given an excel file with the field values and was thinking of a bulk update like bulk insert, but i don't recall that it's possible that way.
Is the only way to create a table, bulk insert, then merge the two tables together with UPDATE?
Just wanted to see if there was an easier way to do it, otherwise i'll take the latter route. Thanks!
I have a table containing 8 million records. I need to replace 2 million of these records with a scaled down query that goes something like: SELECT 1, ShareholderID, Assets1 FROM MyTable (Yields appx. 200,000 recods) SELECT 2, ShareholderID, Assets2 FROM MyTable (Yields appx. 200,000 recods) . . . SELECT 10, ShareholderID, Assets1 + Assest2 + Assets3 + ... + Assets9 FROM MyTable (Yields appx. 200,000 recods)
Updates and cursors just seem to be too slow.
So far I have done the following, but was wondering if anyone could think of a better way. SELECT 6 million records that don't need to be deleted into a #TempTable Use statements above to select into same #TempTable DROP and recreate Original Table SELECT 6 + 2 million records INTO original table.
This seems rather convoluted. Is there a better approach? Would it be worth while to dump data to a file and use bcp / Bulk Insert
I'm trying to use Bulk insert for the first time and getting the following error. I think it might have something to do with my Format File and from the error msg there's a conversion error for the first column. In my database the Field is nvarchar(6) so my best guess is to use SQLNChar for the first column. I've checked the end of each line is CR LF therefore the is correct for line 7 right?
Msg 4863, Level 16, State 1, Line 1 Bulk load data conversion error (truncation) for row 1, column 1 (ASXCode). Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error. Msg 7330, Level 16, State 2, Line 1 Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
BULK INSERTtbl_ASX_Data_temp FROM 'M:DataASXImportTest.txt' WITH (FORMATFILE='M:DataASXSQLFormatImport.Fmt')
Before implementing memory based bulk copy insert with IRowsetFastLoad interface of SQL Server 2005 OLE DB provider, I want to know some considerations.
- performance : compared with T-SQL's "BULK INSERT ..." and bcp utility
- SQL Server's resource usage : when running memory based bulk copy, server resource's influence
- server side action(behavior) : when server is busy, delayed-update means IRowsetFastLoad::Commit(true) method can insert right after?
- row-count : The rowcount limitation can be inserted by IRowsetFastLoad::InsertRow() method before IRowsetFastLoad::Commit
I'm just learning SSIS and I've hit my first bump. I am doing a bulk import from a tab delimited text file to an empty sql table that has a Idendity column defined. How do I tell the bulk insert task to skip that column when inserting from the text file. If I remove the identity column it imports the data fine, but I want to create the indentity column in the table too.
I used upload image feature and below is the code that I used. The image is stored in a folder. I want to save the image in sql database. I create the database which is “database�, and I create a table which is “user�. User table has auto “id� field and “image� field. I want to save the image in the image field. I need your help to do the other codes.
I am using asp.net with VB
This is what I did so far: ============================ Partial Class upload Inherits System.Web.UI.Page Dim strFileName As String
Protected Sub btnupload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnupload.Click UploadImage() End Sub Sub UploadImage()
If Not (fileupload1.PostedFile Is Nothing) Then 'Check to make sure we actually have a file to upload
Dim strLongFilePath As String = fileupload1.PostedFile.FileName Dim intFileNameLength As Integer = InStr(1, StrReverse(strLongFilePath), "") strFileName = Mid(strLongFilePath, (Len(strLongFilePath) - intFileNameLength) + 2)
Select Case fileupload1.PostedFile.ContentType Case "image/pjpeg", "image/jpeg" 'Make sure we are getting a valid JPG image FileUpload1.PostedFile.SaveAs(Server.MapPath(" estimages") & strFileName) lbstatus.Text = strFileName & " was uploaded successfully to: " & Server.MapPath(" estimages") & strFileName
Case Else 'Not a valid jpeg image lbstatus.Text = "Not a valid jpeg image" End Select
I am using the article, " Storing Binary Files Directly in the Database Using ASP.NET 2.0 By Scott Mitchell "
http://aspnet.4guysfromrolla.com/articles/120606-1.aspx I have tried to modify the code and my datatable to replicate the function, but I am getting an error, "MIMEType" is not a SQL Parameter
An SqlParameter with ParameterName 'Type' is not contained by this SqlParameterCollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: An SqlParameter with ParameterName 'Type' is not contained by this SqlParameterCollection.Source Error:
Line 53: Line 54: 'Specify the values for the MIMEType and ImageData parameters Line 55: e.Command.Parameters("Type").Value = MIMEType Line 56: Line 57: 'Load FileUpload's InputStream into Byte arraySource File: E:homeDefaultetances.ushtdocshomeadminaddNews.aspx Line: 55 Code: Protected Sub AddNewsBut_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Page.IsValid Then InsertDs.Insert() Response.Redirect("~/news/default.aspx") End If
End Sub
Protected Sub InsertDs_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) 'Reference the FileUpload control
'Make sure a file has been successfully uploaded If UploadedFile.PostedFile Is Nothing OrElse String.IsNullOrEmpty(UploadedFile.PostedFile.FileName) OrElse UploadedFile.PostedFile.InputStream Is Nothing Then Label1.Text = "If there is no photo of this event, please use a stock photo if you have none available. Else, please upload a photo of the event." e.Cancel = True Exit Sub End If
'Make sure we are dealing with a JPG or GIF file Dim extension As String = Path.GetExtension(UploadedFile.PostedFile.FileName).ToLower() Dim MIMEType As String = Nothing
Select Case extension Case ".gif" MIMEType = "image/gif" Case ".jpg", ".jpeg", ".jpe" MIMEType = "image/jpeg" Case ".png" MIMEType = "image/png"
Case Else 'Invalid file type uploaded Label1.Text = "Please use the correct file type: .jpg, .jpe, .gif, or .png." e.Cancel = True Exit Sub End Select
'Specify the values for the MIMEType and ImageData parameters e.Command.Parameters("Type").Value = MIMEType
'Load FileUpload's InputStream into Byte array Dim imageBytes(UploadedFile.PostedFile.InputStream.Length) As Byte UploadedFile.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length) e.Command.Parameters("Photo").Value = imageBytes
I created a website a year ago. I remember I need to download something from Microsoft (some kind of sql admin thing), which allows me to convert my database in the Express Visual Web developer to sql file, then I can copy those sql commands into my web hosting company's sql admin window to upload the database online. I forgot what things I should download from Microsoft? Please help.
I am building this project and for all the data i put in to the DB Title,Author, etc.... ineed to also add a picture of the book. I terms on space what is the best way to do this? In the DB? Or ref a folder? If so does anyone have sample code for each. ThanksMike
Hi, I am trying to upload a file to database. I have used the following code, every loads good to the database apart from the image, does it go anywhere? I have created a column in the table called 'FileUploadAdvert' and made it an image? Any ideas where I'm going wrong? ThanksGordon Protected Sub btnAdvertSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdvertSubmit.ClickDim dashDataSource As New SqlDataSource()dashDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("DashConnectionString1").ToString() dashDataSource.InsertCommandType = SqlDataSourceCommandType.Text dashDataSource.InsertCommand = "INSERT INTO tblAdvert (AdvertOwner, AdvertName, TopLeftH, TopLeftV, Height, Width, ToolTip, WebLink, AcceptTerms, DateTimeStamp, IPAddress) VALUES (@AdvertOwner, @AdvertName, @TopLeftH, @TopLeftV, @Height, @Width, @ToolTip, @WebLink, @AcceptTerms, @DateTimeStamp, @IPAddress)"dashDataSource.InsertParameters.Add("AdvertOwner", txtName.Text) dashDataSource.InsertParameters.Add("AdvertName", txtCompName.Text)dashDataSource.InsertParameters.Add("TopLeftH", DropDownAccross.Text) dashDataSource.InsertParameters.Add("TopLeftV", DropDownDown.Text)dashDataSource.InsertParameters.Add("Height", DropDownHeight.Text) dashDataSource.InsertParameters.Add("Width", DropDownWidth.Text)dashDataSource.InsertParameters.Add("ToolTip", txtOver.Text) dashDataSource.InsertParameters.Add("Weblink", txtURL.Text)dashDataSource.InsertParameters.Add("AcceptTerms", CheckBoxAgree.Checked) dashDataSource.InsertParameters.Add("IPAddress", Request.UserHostAddress.ToString)dashDataSource.InsertParameters.Add("DateTimeStamp", DateTime.Now) If Not FileUploadAdvert.PostedFile Is Nothing ThenDim filepath As String = FileUploadAdvert.PostedFile.FileName Dim pat As String = "\(?:.+)\(.+).(.+)"Dim r As Regex = New Regex(pat) 'runDim m As Match = r.Match(filepath) Dim file_ext As String = m.Groups(2).Captures(0).ToString()Dim filename As String = m.Groups(1).Captures(0).ToString() Dim file As String = filename & "." & file_ext 'save the file to the server FileUploadAdvert.PostedFile.SaveAs(Server.MapPath(".") & file) lblStatus.Text = "File Saved to: " & Server.MapPath(".") & fileEnd If Dim rowsAffected As Integer = 0 Try rowsAffected = dashDataSource.Insert()Catch ex As Exception Server.Transfer("Register_Fail.aspx") Finally dashDataSource = Nothing End Try If rowsAffected <> 1 ThenServer.Transfer("Register_Fail.aspx") ElseServer.Transfer("Register_Complete.aspx") End If End Sub
We have to upload the database from the production server to the ineternet server. We are making a backup and restoring the databse on the internet sever, this requiers somebody on the serrver to restore the database manually. Is there any other way? Can i overwrite or update the new design the database on the server in any other way? Thanks.
Hello!! i need to upload a csv file to sql server, i am trying to load using bcp or bulk load, but the files has null columns, so i guess, that's why the program is displaying error.
If I need to upload a single value from some singular query to the localvariable it may be like this:set @var = (select F from T where...)Next, what to do if I need more than one?Is it necessary to create a cursor, then open it, fetch and so on? Or may besomething likeset @var1, @var2 = (select F1, F2 from T where...)Thank you.
How to upload a content of a table into sql-file (the set of INSERTs)using standard MSSQL utilities?*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
How to upload a content of a table into sql-file (as a set of INSERTs)using standard utilities?*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
I am using Microsoft SQL Server Management Studio Express and want to insert a row into a table. The table (Pictures) has the following columns: ID (int), Filename (varchar), Data (varbinary).
INSERT INTO Pictures(ID, Filename, Data) VALUES (12, 'photo.jpg', C:photo.jpg);
The statement above does not work. How do you do it?
I have done an bulk upload and I would like to start doing incremental uploads. I just want to upload only the new records that have been added to my data source ( free foxpro tables ). Can anybody point me to an example or info to accomplish this.
Simple question: How do I import/upload/insert data into a new database using MS SQL Server Management Studio Express, from a source like MSAccess or another SQL DB? I currently have a sample sql db (sample.bak), but unless I originally had it in MS SQL Server Management Studio Express it doesn't appear to want to restore it.
Okay, I am still really new at this so nobody laugh if this seems simple stupid. I created a little web page and while working on the project created a new database by right clicking on my app and clicking "Add New item" then choosing SQL Database. I added tables and everything was working just dandy on my machine. I FTP'd the files up to my web server and am now getting an error. SQL is installed on the server, but I have a couple of questions.1. Does SQL have to be installed on the server if you create one of these databases by doing the Add New Item button?2. After Uploading it to a server with SQL installed, the database shows in my App Data folder, but gives me an error. What needs done to move this database to the server besides uploading it?Here is my error:An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Downloaded and installed MSDE and just finished creating a website using the Community Starter Kit. I'm used to working with Access Databases and this is my first experience with anything SQL. Can someone provide my with some guidance as to what I need to do to upload the MSDE Database to a server. Can I just upload the files like an Access Database or is this more involved. Thanks for you help.
Can someone please direct me to a discussion on which version of SQL Server allows a file to be stored in a db field and how this is accomplished as well as how the file is then retrieved with asp.net VB from the DBthanksMilton
Hi there, My problem is that the upload works in testing for our asp.net site only for dbo. Being mindful of security, I would prefer not use this account to execute all sp_/sql. One solution could be using impersonation only in the content management system where the uploading is done, this is code in web.config: <location path="Manage.aspx"> <system.web> <identity impersonate="true" userName="dbo" password="****" /> <authorization> <deny users="?" /> </authorization> </system.web> </location> To do this I would have to change the dbo password as set up by previous employee, not a real dba so not sure of the implications (enough permissions to be dangerous though;). Is the above impersonation ok, or should I redo logins security in sql? Thanks.