Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
Subject: RE: how to create a string of values that can be used to insert in SQL server
Thread ID: 110551 Message ID: 110616 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Friday, October 20, 2006 5:28:18 PM         
   



> > > > I am trying to create a string depending on the cursor fields & its
> > > > type to be used to pass it to insert command for SQL server.
> > > > I am having 2 problems
> > > > 1> How to include character fields with quotes, square brackets & other
> > > > special characters.
> > > > 2> How to send date fields.
> > > > -----------------------------------
> > > > Rajesh Halyal

> > >
> > >
> > > Hi,
> > > Please read my thread: http://www.foxite.com/archives/0000108058.htm
> > > In this I have the generic code for both INSERT and UPDATE, and the
> > > UPDATE string is only added to the update syntax if in fact the
> > > field value has been changed.
> > > The INSERT function does exactly what you want it to do and that
> > > is generically dynamically build a field list and a value list
> > > based upon a local VFP cursor that was created via a SQL-Select
> > > statement against a SQL-Server backend table.
> > > You will notice in the source code the correct conversions have been
> > > made to the strings to hamdle; character, datetime, integer, decimal,
> > > and memo fields.
> > > You will see within the same threads the a DELETE function is also
> > > shown two threads below the thread identified above.
> > > I coded this as I was just sick and tired of entering in large field
> > > and value strings with SQL-Server backend table with many tables
> > > containing over 70-80 fields.
> > > Using generic functions like this will save you a lot of hours in
> > > typo errors and frustration.
> > > Pete from the Great White North. (Only in Canada, ay.) Over and Out ...

> >
> > Pete,
> >
> > You were originally going to do this up as an article. Is there any possiblity that you might still do this? It would certainly make a good one.
> >
> > Ken
> > You shall know the truth - and the truth shall set you free. (John 8:33)

>
>
> Hi Ken,
> I sure hope to. I put it in the forum as I am currently involved in
> one heavy project and working 10-12 hours per day, 7 days per week.
> So with no time, the best I could do was post it in the forum for now.
>
> Pete from the Great White North. (Only in Canada, ay.) Over and Out ...


Pete,

...working 10-12 hours per day, 7 days per week ...

I know how that goes. When you get the time though ...

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD