473,769 Members | 3,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data script

MC


I am writing a script to retrieve data records of MarinLif table. The
problem is that i have a column MarinLif_Pictur e of type image so the
insert is wrong in this way. How do i correct it?
/*****MarinLIf TAble *************** *****/
DECLARE @ID INT
DECLARE @typeID INT
DECLARE @NAME NVARCHAR(50)
Declare @scName nvarchar(50)
Declare @distribution nvarchar(600)
Declare @maxSize nvarchar(200)
Declare @env nvarchar(200)
Declare @climate nvarchar(200)
Declare @country nvarchar(2000)
Declare @desc nvarchar(4000)
Declare @pic image

DECLARE CURS CURSOR STATIC FOR
SELECT MarinLIf_ID, MarinLIfTyp_ID, MarinLif_name,
MarinLIf_ScName ,MarinLIf_Distr ibution,
MarinLIf_MaxSiz e,MarinLIf_Env, MarinLIf_climat e,MarinLIf_Coun try,MarinLIf
_Desc,MarinLIf_ Pic
FROM MarinLif
OPEN CURS
FETCH NEXT FROM CURS INTO @ID,@typeID,@NA ME, @scName, @distribution,
@maxSize, @env, @climate,
@country, @desc, @pic
PRINT 'SET IDENTITY_INSERT MarinLif ON'
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'INSERT INTO MarinLif (MarinLIf_ID, MarinLIfTyp_ID, MarinLif_name,
MarinLIf_ScName ,MarinLIf_Distr ibution,
MarinLIf_MaxSiz e,MarinLIf_Env, MarinLIf_climat e,MarinLIf_Coun try,MarinLIf
_Desc,MarinLIf_ Pic)
VALUES (' + convert(varchar ,@ID) + ','
+ convert(varchar ,@typeID) + ','
+ '''' + @NAME + '''' +
+ '''' + @scName + '''' + ','
+ '''' + @distribution + '''' + ','
+ '''' + @maxSize + '''' + ','
+ '''' + @env + '''' + ','
+ '''' + @climate + '''' + ','
+ '''' + @country + '''' + ','
+ '''' + @desc + '''' + ','
+ '''' + @climate + '''' + ','
+ '''' + @pic + '''' + ')'
FETCH NEXT FROM CURS INTO @ID,@typeID,@NA ME, @scName, @distribution,
@maxSize, @env, @climate,
@country, @desc, @pic
END
PRINT 'SET IDENTITY_INSERT MarinLif OFF'
CLOSE CURS
DEALLOCATE CURS

I am trying to have a script with data that i have in a table for the
purpose of inserting this data in another database under the same table
name. The output of my script is just print statements. I will save
these statements and later on i will execute them on the other database
table.
The problem is with the image and text. Can u give me an example on how
to retrieve data from the image for my script?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
2 1564
MC (an*******@disc ussions.microso ft.com) writes:
I am writing a script to retrieve data records of MarinLif table. The
problem is that i have a column MarinLif_Pictur e of type image so the
insert is wrong in this way. How do i correct it?
...
I am trying to have a script with data that i have in a table for the
purpose of inserting this data in another database under the same table
name. The output of my script is just print statements. I will save
these statements and later on i will execute them on the other database
table.
The problem is with the image and text. Can u give me an example on how
to retrieve data from the image for my script?


You can't assign to image variables, so this approach is not going
to work.

You are probably better off using BCP, a command-line which is designed
for importing and exporting data. In this case you could try:

bcp yourdb..MarinLi f out MarinLif.bcp -N -T -S source_server
bcp yourotherdb..Ma rinLif in MarinLif.bcp -N -T -S target_server

-N here means that you are using native datatypes with Unicode. -T is for
trusted connection. -S specifies the server.

For -N to work, the tables must be identical, including column order.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
To add to Erland's response, if both databases are on the same server, you
can use the INSERT INTO... SELECT syntax:

INSERT INTO MyOtherDatabase .dbo.MarinLif
(
MarinLIf_ID,
MarinLIfTyp_ID,
MarinLif_name,
MarinLIf_ScName ,
MarinLIf_Distri bution,
MarinLIf_MaxSiz e,
MarinLIf_Env,
MarinLIf_climat e,
MarinLIf_Countr y,
MarinLIf_Desc,
MarinLIf_Pic
)
SELECT
MarinLIf_ID,
MarinLIfTyp_ID,
MarinLif_name,
MarinLIf_ScName ,
MarinLIf_Distri bution,
MarinLIf_MaxSiz e,
MarinLIf_Env,
MarinLIf_climat e,
MarinLIf_Countr y,
MarinLIf_Desc,
MarinLIf_Pic
FROM MyDatabase.dbo. MarinLif

--
Hope this helps.

Dan Guzman
SQL Server MVP

"MC" <an*******@disc ussions.microso ft.com> wrote in message
news:40******** ************@ne ws.newsgroups.w s...


I am writing a script to retrieve data records of MarinLif table. The
problem is that i have a column MarinLif_Pictur e of type image so the
insert is wrong in this way. How do i correct it?
/*****MarinLIf TAble *************** *****/
DECLARE @ID INT
DECLARE @typeID INT
DECLARE @NAME NVARCHAR(50)
Declare @scName nvarchar(50)
Declare @distribution nvarchar(600)
Declare @maxSize nvarchar(200)
Declare @env nvarchar(200)
Declare @climate nvarchar(200)
Declare @country nvarchar(2000)
Declare @desc nvarchar(4000)
Declare @pic image

DECLARE CURS CURSOR STATIC FOR
SELECT MarinLIf_ID, MarinLIfTyp_ID, MarinLif_name,
MarinLIf_ScName ,MarinLIf_Distr ibution,
MarinLIf_MaxSiz e,MarinLIf_Env, MarinLIf_climat e,MarinLIf_Coun try,MarinLIf
_Desc,MarinLIf_ Pic
FROM MarinLif
OPEN CURS
FETCH NEXT FROM CURS INTO @ID,@typeID,@NA ME, @scName, @distribution,
@maxSize, @env, @climate,
@country, @desc, @pic
PRINT 'SET IDENTITY_INSERT MarinLif ON'
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'INSERT INTO MarinLif (MarinLIf_ID, MarinLIfTyp_ID, MarinLif_name,
MarinLIf_ScName ,MarinLIf_Distr ibution,
MarinLIf_MaxSiz e,MarinLIf_Env, MarinLIf_climat e,MarinLIf_Coun try,MarinLIf
_Desc,MarinLIf_ Pic)
VALUES (' + convert(varchar ,@ID) + ','
+ convert(varchar ,@typeID) + ','
+ '''' + @NAME + '''' +
+ '''' + @scName + '''' + ','
+ '''' + @distribution + '''' + ','
+ '''' + @maxSize + '''' + ','
+ '''' + @env + '''' + ','
+ '''' + @climate + '''' + ','
+ '''' + @country + '''' + ','
+ '''' + @desc + '''' + ','
+ '''' + @climate + '''' + ','
+ '''' + @pic + '''' + ')'
FETCH NEXT FROM CURS INTO @ID,@typeID,@NA ME, @scName, @distribution,
@maxSize, @env, @climate,
@country, @desc, @pic
END
PRINT 'SET IDENTITY_INSERT MarinLif OFF'
CLOSE CURS
DEALLOCATE CURS

I am trying to have a script with data that i have in a table for the
purpose of inserting this data in another database under the same table
name. The output of my script is just print statements. I will save
these statements and later on i will execute them on the other database
table.
The problem is with the image and text. Can u give me an example on how
to retrieve data from the image for my script?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
38518
by: Jean-Marie Delapierre | last post by:
Hi, I have two files in a directory. one called toto.txt with the following content : 1 2 3 4 5
1
2087
by: SABmore | last post by:
I have the following code that populates 3 independent drop-down boxes with data from arrays. From there the user can select a value from a drop-down list, or input data into a text box. The user then submits this to be inserted into the database. Currently I've only programmed to have the first input box/drop-down valid. The problem I am having is that, even though I've inserted my SQL into a sub procedure, the code is still run prior...
5
2561
by: fochie | last post by:
Greetings, I'm trying to send data to my server using xmlhttp POST. The data being sent is actually an HTML page that is built with javascript in the browser. The HTML code contains a small javascript function in the <HEAD> section. I applied encodeURIComponent to the data prior to sending it but anything between the <script> </script> tags does not get sent. The tramsmitted data is cought by a Perl script on the server, it handles the...
31
4158
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and populating a simple table. I'd like the table to contain 10 entries per page and have the option for the user to scroll through the pages of data without having to go back to refresh the page (I've already pulled all the info I need from the...
2
2685
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in a table that is bound to the island (such that the rows are dynamically generated by IE from the XML data island), the validators do not work. If the table is not bound, the validators do work, but then I don't have the table iterating through...
4
2296
by: Thomas Eichner | last post by:
Hi, does anybody know a public website which offers a service that displays all data send by a browser (or an app calling the website), especially HTTP GET and POST data, browser data etc.? I have a hard time finding what really my app is sending and this would be a great help! Thank you very much ! Thomas
4
2260
by: Cerebral Believer | last post by:
Hi I need help! Forgive me I am a PHP newbie. I have a small script that enables me to send a form from an HTML page. I want to use the HTML formatted form because the design of my website is complex, and I don't want to have to mess around with formatting a page using HTML within php. So basically the "action" of the HTML page sends the form to "ProcReg.php". This is the code: <?php /* Script name: ProcReg.php
5
3217
by: Donald Adams | last post by:
Hi, I will have both web and win clients and would like to page my data. I could not find out how the datagrid control does it's paging though I did find some sample code that says they do it this way, but I can't see these methods as public. BookmarksDataSetTableAdapters.BookmarksTableAdapter bookTA = new BookmarksDataSetTableAdapters.BookmarksTableAdapter(); BookmarkList1.DataSource = bookTA.GetAllBookmarksWrtUser(
1
4006
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. Depends on the pull down list selection, I use script.aculo.us to validate the user input before submit and pass the necessary data, such as contact type, contact information and ranking to a php program for updating. This form should allow multiple...
3
6053
by: jeremy.gehring | last post by:
Hey all, OK I'm not much of a PHP programmer; but needs must as they say. I have written AJAX file upload system that uses a PERL CGI script so that a PHP script can get the progress (nifty progress bar). Everything works great; except that currently I'm not decoding the POST in PERL; so the data file being written is the actual raw form data (multipart/form-data) with parameters and file content. I know that when you make a post to...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7396
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.