473,612 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Building Script with Int

I am currently moving a table from a msSQL DB to a MySQL DB.

I am trying to build the bones of an insert statement by adding strings
to a select statement.

SELECT '(' + job_referenceno + ', ''' + job_title + ''', ''' +
job_category + ''', ''' + job_type + ''', ''' + job_location + ''', '''
+ job_duaration + ''', ' + job_salary + ', ''' + job_contactpers on +
''', ' FROM JobDetails WHERE job_active = 1;

This works perfectly until I try and pull an int column from the Table.
When I add a column to the string that is INT the query returns 0 rows,
with no errors.

Can anyone help explain / overcome this?

Regards,

Tomas

Jan 26 '06 #1
2 1199
Since you are building a string, try casting the numeric values as a string
type when you concatenate the value. Also, consider handling NULLs:

COALESCE(CAST(M yIntColumn AS varchar(10)), 'NULL')

You can find an generalized script to generate insert statements at
http://vyaskn.tripod.com/code.htm#inserts.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Mossy" <to*********@gm ail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I am currently moving a table from a msSQL DB to a MySQL DB.

I am trying to build the bones of an insert statement by adding strings
to a select statement.

SELECT '(' + job_referenceno + ', ''' + job_title + ''', ''' +
job_category + ''', ''' + job_type + ''', ''' + job_location + ''', '''
+ job_duaration + ''', ' + job_salary + ', ''' + job_contactpers on +
''', ' FROM JobDetails WHERE job_active = 1;

This works perfectly until I try and pull an int column from the Table.
When I add a column to the string that is INT the query returns 0 rows,
with no errors.

Can anyone help explain / overcome this?

Regards,

Tomas

Jan 26 '06 #2
Worked perfectly. Thank you.

Tomas

Jan 26 '06 #3

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

Similar topics

1
1189
by: ParE | last post by:
Hello, I wrote a small script which I have been trying to convert to an Executable. I have tried py2exe and McMillians. Both will convert it just fine but when I run it on a machine that does not have Python installed it will run the script twice. Any ideas on how I may fix this? Paras
9
4327
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side vbscript reads the database and populates a listbox on the page with the first field from each record in the recordset. This works fine. - User selects an option on the listbox and, using the OnChange, I
8
3679
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function and passes it two parameters. For the life of me I cannot figure out what the error is, but one occurs everytime I click a &%*$&# radio button. Also, the function only alerts the user immediately as to what question/answer they clicked. I am...
5
10870
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code works fine if I click to open in > the same window, but if I click the browser option to open in a > new window, the new window tries to open the href URL (the > onClick function does get executed, but seems to be ignored). > ...
8
1281
by: biggles | last post by:
I'm building a site in Dreamweaver MX where I have a set of rollover buttons. These buttons go dim when the mouse is over them. When clicked, another image appears on a different part of the page (I built this using the Set Nav Bar image function). This all works fine on my Mac, using my browser safari and Internet Explorer. But on a PC using Internet Explorer the rollovers dim but when clicked nothing happens. Does anybody know why?...
14
1921
by: Bryan | last post by:
I am attempting to make a web page more Netscape friendly... <a href="http:www.gordonceilings.com"></a> I have already corrected the table issues in an offline staging site (where I do the building and then move it to the live site when ready), so don't worry about those. My problem lies in the menu on the left. It shows up and the initial links work in Netscape 8, but the menu will not drop down to show the sub-selections. I can get the...
2
5167
by: Andrew Trevorrow | last post by:
Our app uses embedded Python to allow users to run arbitrary scripts. Scripts that import Tkinter run fine on Windows, but on Mac OS X there is a serious problem. After a script does "root = Tk()" our app's menus are permanently changed in the following way: - The top item in the application menu changes to "About Tcl & Tk...". - The Quit item is disabled. - The File and Edit menus are completely replaced. - All further menus (except...
9
2386
by: Jerim79 | last post by:
Here it is: <?php if($_SERVER=='POST'){ $Number=$_POST; $Email=$_POST; $Number2=0; $error=0;
2
1939
by: troled1 | last post by:
I hace3 a script that needs to write to a mysql database after pulling records from an ACCESS database. The select there are three loops, one outer loop gets the region, the next gets each building in that region and the next gets each room in that building, then moves on to the next region and starts over. The problem is that it writes the first region, the first building and all the rooms in that building. when it goes to the next building it...
0
8173
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
8115
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
8617
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...
1
8254
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,...
0
8422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5537
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();...
1
1699
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1416
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.