Results 1 to 2 of 2

Thread: READTEXT and EXECUTE

  1. #1
    Heather Witt Guest

    READTEXT and EXECUTE

    I am working on a SQL 6.5 application that contains several tables with text fields. I would like to write a single stored procedure that could build the READTEXT statement for the text field on the fly based on parameters I pass in for the table name, column name, etc.

    The procedure I want to write would look something like:

    declare @txtpnt varbinary(16)
    declare @column varchar(15)
    declare @table varchar(15)
    declare @idfield varchar(15)
    declare @idval varchar(15)

    EXECUTE ('select @txtpnt = textptr(' + @column + &#39from ' +
    @table + ' where ' + @idfield + ' = ' + @idval)
    EXECUTE ('READTEXT ' + @table + '.' + @column + ' ' + @txtpnt + ' 0 10000&#39

    Pretty as this looks, if you run this code, you will find that it doesn't work. The EXECUTE statement will not allow you to use a variable in the statement that is not declared as part of the statement. However, if I declare the variable as part of the EXECUTE statement, it is not recognized at compile time and I get an error when I create the stored procedure.

    Is this the brick wall it seems to be, or am I missing something obvious here? I am using Access 97 as my front end, if that helps at all.
    Any insight would be appreciated!


  2. #2
    Eric Dilger Guest

    WScript in DTS and Jobs

    Hello All,

    I have an issue that's been beating on me for a couple of days now. I am experiencing issues with execution differences between a DTS package and that same package scheduled as a jobs. Here's some background:

    I created a vbs to move IIS files from various laocations around the country to one location. My script creates mapped drives and then moves the files. I check for the existence of the files prior to mapping to avoind errors. When I run this script as an ActiveX task in a DTS package it works great. When I schedule the DTS as a job I receive an error on any reference to the non-existent mapped drive.

    If oFS.DriveExists("x:&#34 Then
    oNet.RemoveNetworkDrive "x:", 1, 1
    End If

    It's as though the job is ignoring the existence check.

    I know this question is pretty out there but I'm hoping someone has run into this with WScript.

    Thanks in Advance.

    Eric Dilger

Posting Permissions

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