SQL INSERT For Media?

Questions and answers regarding general SQL and backend databases

SQL INSERT For Media?

Postby bobcusick1332964082 » Wed Oct 09, 2013 9:14 pm

I have a situation where I need to generate SQL INSERT statements from a table with a MEDIA column in it.

For example:

Code: Select all
TABLE: myMedia
COLS:  media_id - TEXT(50 - UUID), media_name - TEXT(255), media_data - MEDIA


I need to generate the statements for each record like:

Code: Select all
INSERT INTO myMedia (media_id, media_name, media_data)
VALUES ('26F07D21-7856-4B09-B69C-554F56819202', 'Test Image', ????)


I'm not sure how to convert the byte array into something that can be inserted into SQL Server...

Any ideas?

Thanks!

Bob
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm

Re: SQL INSERT For Media?

Postby ROCLASI » Wed Oct 09, 2013 10:03 pm

Hi Bob,

Afaik there is no SQL-standard for doing this. You say you need this for SQL Server?
First hit on Google gives me this:
http://social.msdn.microsoft.com/Forums ... getstarted

Hope this gets you further.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: SQL INSERT For Media?

Postby david » Wed Oct 09, 2013 11:49 pm

Another idea: export to a backup file a sample record. Check out the resulting sql in a text editor.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: SQL INSERT For Media?

Postby bobcusick1332964082 » Thu Oct 10, 2013 2:10 pm

Robert - thanks - I know how to do it that way - but I was hoping to avoid having to export all the images, name them, etc. (e.g. was being lazy)...

David - thanks - that was my next move.

I appreciate the feedback!

Bob
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm

Re: SQL INSERT For Media?

Postby ROCLASI » Thu Oct 10, 2013 2:26 pm

Hi Bob,

But why not use Servoy as a data-pump for this?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: SQL INSERT For Media?

Postby david » Thu Oct 10, 2013 3:34 pm

If this is a large job, some ideas: http://www.servoymagazine.com/home/2013 ... lugin.html
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: SQL INSERT For Media?

Postby bobcusick1332964082 » Thu Oct 10, 2013 11:32 pm

That's what I'm going to wind up doing - using Servoy itself.

David - I like your multiple headless solution - I've used the same technique before as well - works great!

AGAIN - THANKS GUYS! :)
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 5 guests