Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

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_contactperson +
''', ' 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


Report this thread to moderator Post Follow-up to this message
Old Post
Mossy
01-26-06 09:57 PM


Re: Problem Building Script with Int
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(MyIntC
olumn 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" <tomas.breen@gmail.com> wrote in message
news:1138275770.510579.240490@z14g2000cwz.googlegroups.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_contactperson +
> ''', ' 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
>



Report this thread to moderator Post Follow-up to this message
Old Post
Dan Guzman
01-26-06 09:57 PM


Re: Problem Building Script with Int
Worked perfectly. Thank you.

Tomas


Report this thread to moderator Post Follow-up to this message
Old Post
Mossy
01-26-06 09:57 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 05:26 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006