Trim away from variable in Stored proceedure?

Below i have a Store Procedure with 3 variables that I pull
in. The
@search1 and @search3 are not the problem because they can
hold 100 or
6000 characters. The @search2 gives me a problem because,
when I use the
search form on my page and type more than 20 characters, I
get an error.
Well, that is if I got the error nailed down.
The error I get is "Application uses a value of the wrong
type for the
current operation." Line 192 is the @search2 line.
My question is how would I trim away characters above 20 just
on the
@search2?
Also, do you seen any areas that I could do some "error
catching" in
this SQL ?
Thanks
CREATE PROCEDURE searchresults
@search1 varchar (100),
@search2 varchar (20),
@search3 varchar (6000)
AS
SELECT P.ID AS ProductID, P.Name, P.ProdID, P.Price,
P.ClearSale,
P.SalePrice, P.ShipCost, G.gid, G.pid AS Gpid, G.ord, D.PID
AS DPID,
D.Paragraph, C.Category
FROM atblProducts P
INNER JOIN Groups G ON P.ID = G.pid
INNER JOIN PCat PC ON G.gid = PC.gid
INNER JOIN Categories C ON PC.cid = C.ID
LEFT JOIN Description D ON G.gid = D.PID
WHERE (P.Price IS NOT NULL AND P.Price <> 0 AND
P.Active <> 0 AND PC.ord
= 0 ) AND (P.Name LIKE '%' + @search1 + '%' OR P.ID LIKE '%'
+
@search2 + '%' OR D.Paragraph LIKE '%' + @search3 + '%')
ORDER BY G.gid, G.ord, P.ID, P.Name
GO

"Art" <[email protected]> wrote in
message
news:fhvsds$no$[email protected]..
> Below i have a Store Procedure with 3 variables that I
pull in. The
> @search1 and @search3 are not the problem because they
can hold 100 or
> 6000 characters. The @search2 gives me a problem
because, when I use the
> search form on my page and type more than 20 characters,
I get an error.
> Well, that is if I got the error nailed down.
>
> The error I get is "Application uses a value of the
wrong type for the
> current operation." Line 192 is the @search2 line.
>
> My question is how would I trim away characters above 20
just on the
> @search2?
>
> Also, do you seen any areas that I could do some "error
catching" in this
> SQL ?
>
> Thanks
>
> CREATE PROCEDURE searchresults
> @search1 varchar (100),
> @search2 varchar (20),
> @search3 varchar (6000)
> AS
> SELECT P.ID AS ProductID, P.Name, P.ProdID, P.Price,
P.ClearSale,
> P.SalePrice, P.ShipCost, G.gid, G.pid AS Gpid, G.ord,
D.PID AS DPID,
> D.Paragraph, C.Category
> FROM atblProducts P
> INNER JOIN Groups G ON P.ID = G.pid
> INNER JOIN PCat PC ON G.gid = PC.gid
> INNER JOIN Categories C ON PC.cid = C.ID
> LEFT JOIN Description D ON G.gid = D.PID
> WHERE (P.Price IS NOT NULL AND P.Price <> 0 AND
P.Active <> 0 AND PC.ord =
> 0 ) AND (P.Name LIKE '%' + @search1 + '%' OR P.ID LIKE
'%' + @search2 +
> '%' OR D.Paragraph LIKE '%' + @search3 + '%')
> ORDER BY G.gid, G.ord, P.ID, P.Name
> GO
You'll have to trim BEFORE it's assigned to a command
parameter's value,
in VBScript: Left(myVariable, 20), if you show line 192 I can
provide the
context where to paste

Similar Messages

  • Text variable + text with tabs to align away from spine

    Hello
    I need a document header that shows the chapter captions. So I created a text variable that picks the format of the caption.
    But the chapter captions have tabs:
    I.>Introduction
    So in the header, on the left pages it looks fine:
    alignment is "away from spine"
    I.>Introduction
    But on the right page the chapter number remains with the spine, only the text after the tabs aligns "away from the spine":
    I.                 >                                   Introduction
    I found it difficult to search for this on google and the forum (and no result) - and hope I made it clear in the text above I can't believe it's a rare problem and really hope I just oversee something and it can be solved..
    Thank you!!

    Some details about how the paragraph is constructed would help. I'm guessing here that the variable is a running head variable based on paragraph style, and that the nmber is manually typed, along with the tab, rather than being a numbered list.
    If that's the case, substituting one or more em spaces or other fixed-width spaces in combination for the tab should solve the problem in the headers, but may cause other issues in the body of the text if your intention by using the tab was to always have a variable space between the number and the words depening on how many characters there are in your number. With roman numerals and proportional fonts it would be difficult without the tab to always have the chapter title itself begin at the same x-coordinate in the frame regardless of the number.
    To overcome that issue, you can use two variables in the header, both designated as Running Header (character style), and separate them with an em-space or similar (not a tab). If there are not already nested styles in use for the titles, create two character styles that are nothing but names, then in the paragraph style for your chapter titles go to Drop Caps and Nested Styles and apply the first character syle up to 1 tab character, None through 1 tab character, and the second character style through 1 sentence. You two character style based variables in the header will pick up the two parts of the paragraph. It seems unlikely that anyone would notice or care that the spacing is fixed between number and text in the headers but not on the page, especially since the alignment shifts from page to page.

  • Using the new iPad, what's the best way to watch video files (away from home) which are stored on a NAS (WD My Book Live)? Any help would be appreciated!

    Using the new iPad, what’s the best way to watch video files (away from home) which are stored on a NAS (WD My Book Live)?  Any help would be appreciated!

    Before you go, move the files to I tunes and sync them down.  There is no viable way to stream from your nas drive to the pad.

  • Adding Music when away from external Drive where Itunes Library is stored

    I have a macbook and an Ipod 60gb. I have come across a slight frustration in Itunes. I have limited space on my internal drive and as such have my iTunes music stored on an external hard drive. I frequently am away from this drive when I import a cd into itunes. The problem, itunes switches where my library is stored from the external drive to the internal drive. Is there an option that someone knows about that would keep this from happening?
    I have a suggestion for itunes, why not make an option to add music to a briefcase folder, and when connected to the external drive add it to the main library. This would allow for music to be imported to the computer and then be added to the main storage source when available.
    If anyone knows a way I send a product suggestions to apple please let me know, as I have a few that would like to suggest.

    mattbeardall wrote:
    Is there an option that someone knows about that would keep this from happening?
    no, if iTunes can't find its drive/folder, it defaults to creating one within your Home directory's Music folder.
    If anyone knows a way I send a product suggestions to apple please let me know, as I have a few that would like to suggest.
    under the iTunes menu choose the Feedback menuItem.

  • Good source for learning - SQL Stored Proceedures using Dreamweaver

    I am looking for a good source for learning how to integrate
    Stored
    Proceedures using Dreamweaver?
    Is there a book or something online?
    Thanks

    Hey Lee,
    You find yourself in that position, I find myself in that
    position, every
    damn developer/programer in the world find themselves in that
    position. It
    may be on different levels, but everyones in the same boat.
    Here is my suggestion. Take the existing knowledge you have,
    pick a
    technology that is a bit more futureproof (if the one you
    have is getting
    outdated) and one that isn't too far removed from the one you
    know and put
    it all into that one area.
    Databases are really important if you want to be a decent web
    developer. If
    you're serious and want to be good then devote time to a
    particular database
    and get to know it well. I would suggest SQL Server. You
    don't have to be
    DBA standard but get as much knowledge on it as you can.
    Never underestimate
    your required knowledge of databases.
    Set yourself goals. Say to yourself "In 6 months I want to be
    a proficient
    developer in this language" and go for it. Don't get
    side-tracked into
    something else just keep focused on one area and get good at
    it. Yes, that
    language will become outdated in time but you will be all the
    more ready to
    take on the next because of your past experiences.
    I try to look at it like this; It is better to a master of
    one technology
    and know enough to get by in others than a Jack of all
    technologies but a
    master of none.
    Pat.
    "lee" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks Pat...I only looked at it briefly but it looks
    like what I needed.
    >
    > The biggest problem that I have is that I don't have
    enough time to look
    > into some of this stuff...
    >
    > Over the years, I've gotten to a certain level of
    proficiency in certain
    > things, I can do quite a bit but there always seems to
    be yet another
    > technology to master as the Old Ways go away.
    >
    > To be honest, I really just want to be an artist with
    some programming
    > skills but the nature of this position demands that I
    "learn It all."
    >
    > Meanwhile, all those other skills have to be put
    asside...I really should
    > master flash...I really should work on my illustration
    skills...I really
    > should master CSS. I really should master...I don't
    know, name it. And if
    > I really wanted to abandon my ...LIFE...I could,
    perhaps, figure it all
    > out.
    >
    > What is so tiring is that my skill set is stretched SO
    f-ing thin that I
    > can never, possibly catch up. The only cure is time but
    often even that
    > goes against me.
    >
    > Anyways, thanks for the link. I'll probably be back
    later with questions.
    >
    > Thanks Pat.
    >
    > If anyone else finds a good source, let me know.
    >
    >

  • BO v5.1 - creating a report from an oracle stored procedure

    Post Author: newrochelle
    CA Forum: Publishing
    hi to all,
    im using BO 5.1 and i need to create a document from an oracle stored procedure that have only one IN parameter and ten OUT parameters.
    Creating the new report I selected the database connection then I choose the stored procedure name from the list, I inserted the value for the IN parameter and finally I click on Run button.
    I got the following error message:
    ORA-06550: line 1, column 38: :PLS-00103: Encountered the symbol
    "," when expecting one of the following: : : ( - + case mod
    new not null others <an identifier> : <a double-quoted
    delimited-identifier> <a bind variable> avg : count current
    exists max min prior sql stddev sum variance : execute forall
    merge time timestamp interval date : <a string literal with
    character set specification> : <a number> <a single-quoted SQL
    string> pipe : <an alternatively-quoted string literal with
    character set specification> : <an alternatively-q :-6550
    it seems to be caused by the OUT parameters!
    i leaved them without any value.
    it's the first time that I used a stored procedure to create a BO report, but I think the OUT parameters are needed to do that, otherwise what data will be presented in the report???
    can you help me?
    please answear me ASAP.
    Thank's in advance
    Regards
    Andrea

    Post Author: synapsevampire
    CA Forum: Publishing
    Try posting in a BO forum, this is Crystal Reports.
    -k

  • Pass BPC SSIS variable to stored procedure

      Dear All
    We have a ssis package in which there is data flow task. There
    is a OLEDB source which uses “Data access mode” as sql command. We used OLEDB data source instead of execute sql task as the outuput is table format generated in Stored proc which is used in following task
    This task calls a stored procedure with a input parameter which will be appset name.   [EXEC ProcName '@BPCAPPSET']
    The stored procedure is executing fine without any issues.But when I pass variable containing appset name to that stored  procedure its not taking properly and package ending successful.
    The variable is “BPCAPPSET” it contains appset name which
    will be taken front end.
       However to test if this value is taken by stored procedure
    or not, I tried to hardcode and pass appset name to stored procedure. i.e exec
    ProcName Appset1.
      Appset1 is existing appset. It worked fine. But we want to
    put this package in all land scapes, such that whenever it is triggered it will
    take the appset as parameter and does the calculation in stored procedure.
       Please advice how to pass this variable to stored
    procedure.
    regards
    Prasad

      Hi Roberto
    Thanks for your mail.
    I have tried, but I am getting error that @BPCAPPSET scalar
    variable must be defined.
    I believe that @BPCAPPSET is system defined variable which
    will be passed from Data manager package. May be this is the reason it is not
    recognizing this variable?
    If so, should I define a variable in SSIS. How can we
    assign value of @BPCAPPSET to the newly defined variable?
    Please advise. Attached screenshot.

  • Can I use iTunes Match while I'm away from Home, and my family still use Home Sharing via Apple TV?

    I would like to be able to use my iTunes Match account as I am frequently away from home.
    However, my family would also like to be able to use Home Sharing to listen to music, watch movies stored on the family iMac, using the Apple TV.
    At the moment, iTunes Match & Apple Store uses a different Apple ID to Home Sharing.  I don't want the kids to be able to download movies etc on the Apple TV.
    Is there a way that I can achieve both at the same time?

    Yes, iTunes Match alleviates this situation.  As long as iTunes on both of your computers is using the same Apple ID, you can add songs to either one, and once they have uploaded to iCloud, they will be available on any of your iDevices AND in iTunes on the other computer.

  • How do I stream purchased movies to my Macbook Pro if I've already downloaded them and moved the source files to an external desktop hard drive and I'm away from home?

    I recently added a number of movies to my iTunes library by redeeming digital copeis that came with Blu-rays. Due to limted disc space on my MacBook Pro, and for safe keeping, once I downloaded the movies, I moved the source files to an external desktop hard drive. When I'm home and I'm able to access that external HD via my home network, I'm able to watch the movies without an issue. However, if I'm away from home and I want to watch them, I'm not sure how to do that. I thought I could "stream" purchased movies from within iTunes  - even after downloading them - using "iTunes in the Cloud" but can't figure out how to do that, or it simply isn't possible.
    What are my options?

    I understand that I can't play my downloaded movies when my external HDD is not connected becuase iTunes is looking for the downloaded files. This is not the issue. The issue is that because my HDD is not connected (as in when I'm away from home) I'd like to be able to stream the movies via the cloud.
    If I hadn't downloaded the movies when I redeemed my codes, would I have been able to keep the movies online via Apple iCloud and watched them anytime by streaming them or must the movies be downloaded in order to be viewed on my MacBook?  I read that Apple allows movies purchased (or redeemed) via iTunes to be stored in the cloud via Apple iCloud so that they can be viewed any time, on any device.  IF this is the case, how does it work? From what I can see, it looks like movies can only be "streamed" from the cloud when useing Apple TV; on my iPhone and MacBook Pro, it looks like they need to be downloaded in order to be viewed.
    Can someone clarify this for me?
    Also - Michael - when you said that If I've already downloaded the film but I'm away from my external HDD I should "Delete the entry from the iTunes library so iTunes only sees the iTunes in the Cloud version", what exactly would this mean? Would this mean that I could then stream the movie from the cloud or would I have to re-download it to my Mac's internal HDD in order to watch it?
    Many thanks!

  • Creating a table/view or temporary table from within a stored procedure

    Hi Gurus,
    Can someone tell me if it is possible to create a table (or view) from within a stored procedure.
    PROBLEM:
    In fact I need to create a report at back end (without using oracle developer forms or reports). This report requires creating several tables to hold temporary report data. If I create a sql*plus script for this, i works fine, because it can run DDL and other sql or pl/sql statements sequencialy. But this sql*plus script cannot be called from application. So, application needs an stored procedure to do this task and then application call that procedure. But within stored procedure, i am unable to create table (or run any ddl statement). Can somebody help me in this?
    Thanks in Advance.

    Denis,
    The problem with Nicholas' suggestion isrelated to the fact that now you have two components
    (a table and a stored procedure)
    I don't see any problem to have "two
    components" here. After all, what about all others
    tabes ? This is only one more, but I don't understand
    why want manage less objects, that implies more code,
    more maintenance, and more difficulties to debug.
    Needless to say about performance...
    Nicolas.The same reasons apply if you were forced to declare all PL/SQL variables publicly (outside the stored proc.) rather than privately (from inside the stored proc). Naming conflicts for one. If the name that you want to use for the GTT already exists, you need to find a new name. With the SQL Server type local/private declarations, you wouldn't have that problem.
    I can see how performance would be the same or better using GTTs. If the number of records involved is low, this is likely negligable.

  • Doing catalog work on laptop when away from desktop computer

    I just recently moved from doing all my work on a single machine (laptop, MacBook Pro) connected to a 5 bay external hard drive to using 2 machines, a desktop (Mac Pro) hooked up to the 5 bay eternal HD and the laptop.
    My set up - Desktop running Snow Leopard, Laptop Leopard. They are networked with an Airport Extreme. I log into the Desktop from the laptop rather than use File Sharing.
    I'm still using Lightroom 2.7, single license, so I wouldn't have LR running on both machines at the same time. Catalog is stored on the Desktops internal HD - User/Pictures/Lightroom/Catalog. I use a single catalog, 30,000+ images. Catalog is approx 550MB.
    I've got it pretty well figured out how to export a catalog from the laptop to the desktop after returning with images from a shoot, but, while I work a lot at my desk on the desktop, I want to be able to work on my catalog with my laptop. Hoping for some advise on how to do that. I'm looking to only do catalog type work on the laptop - evaluating, rating, deleting, keywording etc. I will not be doing any Developing or working on the actual image files, which are stored on the external 5 bay HD connected to the Desktop.
    2 situations:
    1. When I'm in another part of my space with my laptop and connected to my desktop (wireless), I go to the catalog located on the Desktop, I get a msg that Lightroom catalogs cannot be opened on network volumes. So how do I simply work on my LR catalog, using the laptop, when I'm networked to the Desktop?
    2. When I'm away from my space, traveling etc, so not networked to the desktop. In this case I assume I would want to Export a copy of the catalog onto the laptop or a small portable HD and work on it while I'm away. But when I return, should I then Export the whole catalog back to the Desktop, or is there a Synchronize type function where LR updates the changes only? Is there a safe way to do this that minimizes the risk of introducing errors if the whole master catalog is moved back and forth? Should I break up my single large catalog in to smaller bite sized chunks that would be easier to move back and forth?
    Thanks for any advise. If this is easier to accomplish on LR 3, that would be a good reason to upgrade. 

    My master catalogs are heftier than I want to clone all over the place so I use the following method.
    In LR, put the files you want to work on in a subfolder of your Primary catalog
    Export Folder As Catalog with previews, but without including the DNG's
    At your new location/machine work on that catalog.
    Here's the part that's no fun, (obviously have a backup of your catalog before you do this)
    In your primary catalog REMOVE that folder from your catalog. (this will remove all references within your catalog, but leave the RAW files alone where they were)
    You then FILE-->IMPORT FROM ANOTHER CATALOG, and import your subfolder export back into your Primary catalog.
    It'll bring all of your changes and previews back into your Primary catalog but with unlinked RAW files.
    Click on the question mark in the corner of the thumbnail that's telling you it doesn't know where the source files are and LOCATE the original file again in your file structure, with the FIND NEARBY MISSING PHOTOS box checked.
    Overly complicated for what it is, but it gets the job done.

  • I want to be able to access my main computer when I'm away from home. Are there honest and trusted 3rd party applications that allow access to the home computer when I'm traveling?

    the job takes me away from home and at times I need information stored on the iMac. I would like to access the main computer and its files through a second computer, Mac Pro. Is there a service that will allow me to access my main computer when I'm traveling? For example if I'm in Brasil and need to access files found in my main computer in Canada, what reliable allows me to connect between the 2 computers?

    Yes,
    http://support.apple.com/kb/PH10618?viewlocale=en_US
    other ways:
    http://www.macworld.com/article/1152611/remoteaccesintro.html

  • Inserting or embed and image into cfmail output from a database-stored path to an actual image.

    I am trying to insert or embed and image into cfmail from a database-stored path to an actual image. The actual JPEG image is stored in a folder called "images_personnel". The path to the image under the column titled photopath is stored in my database table as "/file/images_personnel/28.jpg". Displaying the image on the screen renders without a problem, embedding the same image as part of a cfloop query does not insert/embed the image into an email. All of the other output of the same cfloop displays and emails just fine. However none of the photos of each personelle show up. What an I doing wrong?
    My code is below:
    <cfquery name="Staffreport" datasource="master">
    Select staffreport.*, name.personnelid, name.email, name.last, name.noiid, stafflt, CONCAT(name.fname,' ',name.middle,' (',name.last,')') AS teammember, CONCAT(name.fname,' ',name.middle) AS teammember2, concat(name.photopath,'',name.photo)as hisphoto, stafflt.*, trim(concat(ltfname,' ',ltmiddle)) as LT from Staffreport, name, stafflt
    where 0=0
    and stalt = '#Session.user_id#'
    and ltid = '#session.user_id#'
    and staweekbegin = <cfqueryparam value="#form.staweekbegin#" cfsqltype="cf_sql_date" />
    AND staweekend = <cfqueryparam value="#form.staweekend#" cfsqltype="cf_sql_date" />
    AND stapersonnelid = personnelID
    <!---AND ltid = stalt--->
    AND CITY = 'richmond'
    AND STATUS <> 'd'
    AND STATUS <> 'T'
    AND type = 'personnel'
    Group by personnelid
    Order by teammember
    </cfquery>
    <cfmail>...
    <cfloop query="staffreport"><br />
    <table width="90%" border="0" cellspacing="2" cellpadding="4" align="left">
      <tr>
        <td colspan="2" align="center" valign="top" nowrap="nowrap" bgcolor="cccccc"><strong><font color="black"><cfif #staffreport.last# eq ".">#Ucase(Staffreport.teammember2)# <cfelse>#Ucase(Staffreport.teammember)#</cfif> - ID: <cfoutput>#Staffreport.noiid#</cfoutput></font></strong></td>
      </tr>
    <tr>
        <td align="left" valign="top" nowrap="nowrap" bgcolor="#000000">Name:</td>
        <td>#Staffreport.teammember#</td>
      </tr>
    <tr>
        <td bgcolor="E6E1FD">Photo:</td>
        <td bgcolor="EBEBEB">
    <img src="#staffreport.hisphoto#" alt="Photo" width="98" height="98">
    </td>
      </tr>
    <tr>
        <td bgcolor="E6E1FD">Email:</td>
        <td bgcolor="EBEBEB">#staffreport.email#</td>
      </tr>
    </table>
    </cfloop>
    </cfmail>

    You'll need to provide a full URL link to the image ("http://mywebserver/file/images_personnel/28.jpg"), not just a relative path.  Remember, the email client that is used to view the email content knows nothing of the internals of your web server - it can only follow a complete URL to get images and other resources.
    -Carl V.

  • How can I convert the variable expression stored as string back to variable expression

    How can I convert the variable expression stored as string back to variable expression?
    I am storing the expression enterd in the TSExpresssionEditControl as simple string and want to convert back to expression since I want to get the data type of that expression.

    pritam,
    I'm not sure what you're trying to do exactly. If you are trying to get the value of a variable and you only have the name of value in a string, then you can use Evaluate() to get its value. If you want the data type, my advise is to use the GetPropertyObject() API method and just pass in the loop up string. Then you'll have a handle to the data object and then proceed from there.
    Regards,
    Song D
    Application Engineer
    National Instrument
    Regards,
    Song Du
    Systems Software
    National Instruments R&D

  • How to use lengthy query in a "SQL Command from Variable"

    My oracle SQL Query length is more than 14000 characters, so how can i use this for "SQL command from variable".
    Sarvan

    Either create a view or a table valued UDF. Using stored procedure in OLEDB source has some gotchas it will not pick up metadata information by default due to late binding.
    http://consultingblogs.emc.com/jamiethomson/archive/2006/12/20/SSIS_3A00_-Using-stored-procedures-inside-an-OLE-DB-Source-component.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Fault message in BPM process

    I have a bpm process with a sync send step. i have a default fault message strcuture and my sync interface ( a proxy) is using this as fault message format. In case of an fault in the proxy i get the fault message returned. In my bpm i have an except

  • How to create an applet in a JDestopPane?

    hello i would like to create an applet (JApplet) in a desktop (JDesktopPane). i have to put the applet in a JInternalFrame so i can move and resize the window around. indeed i can have several applets in the JDesktopPane. it would be more powerfull t

  • Query regarding screen capture in webdynpro

    Hi i needed to use the java.awt.Robot class to perform a screen capture. This is basically used to capture signature which is done on a applet. But hwile i am using it gives me java.awt.headless exception which basically means that i cannot use displ

  • Agent is determining properly but workitem is not coming in sap inbox.

    Hello Expert,                         In my workflow agent is determining properly. i have seen from workflow log. but the workitem(approval mail) is not coming into agents workflow inbox.the problem is happening in production. same workflow is runni

  • Line item in sales order

    Hi sdn team, can i delete line items in sales order...i mean i was asked not to do so..... when i do so what kind of consequences will i have to look forward to? regards.