Results 1 to 7 of 7

Thread: Writing an "empty" string to a MS SQL 7 database.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Writing an "empty" string to a MS SQL 7 database.

    Am using a non MS language that doesn't recognise the concept of NULL or EMPTY fields.

    When I update the table, standard ODBC connection, it writes NULL into the table fields for any variable that doesn't have a value.

    Is it possible to send a character string/ESC sequence to MS SQL telling it to insert an EMPTY field rather than a NULL field?

    Am unable to touch the actual SQL database, i.e provide a trigger, as it's not ours to modify.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Writing an "empty" string to a MS SQL 7 database.

    Well...

    Show us the code anyway - who cares if it's a non MS language - I still want to see what you are doing.

    How could I suggest a solution without seeing what you are trying?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Re: Writing an "empty" string to a MS SQL 7 database.

    Quote Originally Posted by szlamany View Post
    Well...

    Show us the code anyway - who cares if it's a non MS language - I still want to see what you are doing.

    How could I suggest a solution without seeing what you are trying?
    I would have thought the question was blatantly obvious, can you write a string to a MS SQL database that will enforce it to update a field to being an empty field.

    I could post some code but it really wouldn't help you unless you understand the concepts of Multi-value coding, D3 ODBC handling, and OpenDB global triggers

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Writing an "empty" string to a MS SQL 7 database.

    The question is not totally obvious, as there are important things we don't know... hence why you were asked for some clarification (even if the code isn't 'easy' for us, it would almost certainly help us, and also make it easier for us to give examples).


    My thoughts after reading the first post were that if you are using an SQL statement (with or without parameters) to write to the database, the issue can probably be solved by fairly simple string building. If not, a possible solution is to run an Update afterwards.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Writing an "empty" string to a MS SQL 7 database.

    in short - yes, you can construct a SQL statement to insert or update an empty string: UPDATE SomeTable SET SomeField = '' WHERE someotherField = 'SomeValue'

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Location
    Godzone, oops Oz
    Posts
    355

    Re: Writing an "empty" string to a MS SQL 7 database.

    Quote Originally Posted by si_the_geek View Post
    The question is not totally obvious, as there are important things we don't know... hence why you were asked for some clarification (even if the code isn't 'easy' for us, it would almost certainly help us, and also make it easier for us to give examples).


    My thoughts after reading the first post were that if you are using an SQL statement (with or without parameters) to write to the database, the issue can probably be solved by fairly simple string building. If not, a possible solution is to run an Update afterwards.
    No wonder people are finding other sites to get help. It would take the size of the db in this product to explain multivalue as it doesn't work like vb or any other MS style language. The code would be meaningless to you folk, the question was simply can you generate something to tell MS SQL to insert an "empty" rather than NULL field. I explained we do not have access to the MS SQL app in order to "run an Update afterwards", though of course a trigger may have been the ideal solution otherwise.

    You can close this one as got the answer in five minutes at a site that didn't need code being posted or my life story and who's posters actually read the question and explanations.

    For anyone else hitting the same issue, D3 doesn't have the ability to generate "empty" strings to MS SQL in the current or next versions, but there are a few work arounds that the good folk at T-Data and a few other technical sites can point you in the direction of, bit of a kludge. TG thanks for the answer but that's the crux of the problem, was hoping for maybe an escape sequence of some sort that's undocumented. For example in D3 to enforce an empty value in our db we would use either a @VM for a multivalue or an @AM for an attribute

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Writing an "empty" string to a MS SQL 7 database.

    There's no need for that kind of attitude, we were clearly just trying to help.

    My post was not referring to running things in the database system itself (you had implied that you are capable of sending statements to the database from your app, which my Update suggestion was about [and I presume TG's post was too]), and we certainly did not ask for you to explain multivalue (not surprisingly people here may already know, or be able to easily work out enough, as many of us use multiple languages/databases/etc).

    No matter what you think, you had not made things clear - and posting a code sample (even if it is an unknown language) generally gives a lot more clarity than you have given until now.
    Quote Originally Posted by KiwiDexter View Post
    You can close this one
    That is your task, not ours.

    You can do it by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).

    Quote Originally Posted by KiwiDexter View Post
    didn't need code being posted or my life story and who's posters actually read the question and explanations.
    That is a ridiculous implication to make, and I find it offensive.

    Not being able to give you a perfect answer straight away when you refuse to even comply with a simple request for a code sample does not mean that we didn't read what you wrote - and given that your refusal seems to be based on you not wanting to explain it (which nobody asked for, in fact we blatantly implied we didn't want it), it heavily points at you not paying enough attention.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width