Varchar(Max) field cutting off data after 8000 characters SQL Server 2008

Hi,
We have a scenario on which we are preparing the SQL query dynamically by string concatenat and then at the end EXECUTING the query using EXECUTE statement but observed that the VARCHAR(MAX) data type is not storing more then
8000 character.
Here is the code snip.How i am using and where the variable is not storing more them 8000 character
We have a table "tblUserAssignedResourcesData" where we are storing "FilterType" and "FiletrValue" and then preparing the string like this:
DECLARE @sqlQuery_UR VARCHAR(MAX)   
SET @sqlQuery_UR=''
DECLARE @agentsColumns_UR VARCHAR(MAX)             
SELECT @agentsColumns_UR = ISNULL(@agentsColumns_UR,'') +''''+ FilterValue + ''''+',' FROM @tblUserAssignedResourcesData Where FilterType = 1             
SELECT @agentsColumns_UR = LEFT(@agentsColumns_UR,LEN(@agentsColumns_UR)-1)             
SET @sqlQuery_UR=@sqlQuery_UR+'[UserAgent] in('+ @agentsColumns_UR +')'
--Upto this all the Agents are storing properly then adding mobility user
DECLARE @mobilityColumns_UR VARCHAR(MAX)            
SELECT @mobilityColumns_UR = ISNULL(@mobilityColumns_UR,'') +''''+ FilterValue + ''''+',' FROM @tblUserAssignedResourcesData Where FilterType = 3               
SELECT @mobilityColumns_UR = LEFT(@mobilityColumns_UR,LEN(@mobilityColumns_UR)-1)
SET @sqlQuery_UR=@sqlQuery_UR +' or '+'[MobilExtensionID] in('+@mobilityColumns_UR+')' 
print '@sqlQuery_UR ->' + @sqlQuery_UR
--Print statement should print all the Agents and Mobility values but it is not printing and hence my SQL query is faling to execute
Anyhelp will be appriciable
Thanks,
Bijay

Whats the value of @mobilityColumns_UR  before the below statement? This would give you
some idea.
--Upto this all the Agents are storing properly then adding mobility user
DECLARE @mobilityColumns_UR VARCHAR(MAX)             
SELECT @mobilityColumns_UR = ISNULL(@mobilityColumns_UR,'') +''''+ FilterValue + ''''+',' FROM @tblUserAssignedResourcesData Where FilterType = 3               
SELECT @mobilityColumns_UR = LEFT(@mobilityColumns_UR,LEN(@mobilityColumns_UR)-1)
print '@mobilityColumns_UR  ->'
+ @mobilityColumns_UR 

Similar Messages

  • Crystal Reports XI connection problems - after updating to SQL Server 2008

    Hello!
    We have some ASP.NET 2.0 Applications that call some CR XI report files with parameters to generate PDF Files. After upgrading from SQL Server 2005 to 2008 the apps hang when trying to generate the PDFs. Some research with Fiddler showed that ever time a 401 Error is raised. Calling the reports directly from CR Designer with the same connection values and Parameter shows the appropriate data that means the log-in data iare functioning.
    I already tried switching the data source driver from OLE DB to SQL Native - no effect!
    Can it be that CR XI does not work with SQL Server 2008? Or is there an update for CR XI and SQL Server 2008?
    Because we are in a hurry I hope somebody can solve my problem(s) ...?!
    Thanks in advance,
    Frank

    Hi Frank,
    No CR XI is not supported nor is any version completely at this time. What we've found issues in so far are the Time(7) time is returned as a string value and Stored Procedure Data/time parameter SQL creation. The Time(7) field is an OLE DB driver issue with Microsoft but the Date/time SP issue is our issue and it's currently tracked and escalated. It will be fixed for CR 2008 with SP3 I believe. And I've asked that the same fix be rolled back to CR XI R2 but waiting on the reply from R&D if it can be done.
    What you need to do is download the trial version of CR XI R2 ( Release 2 ) and then use your XI Keycode to install it and it will work. Then update to the latest SP 5 Service Pack. XI is past it's end of life support which means there will be no updates or bug fixes any more.
    Next, MS SQL Server 2008 does not work with the MDAC version of the Native drivers, you must install the MS SQL Server Client. You'll see the driver name is "MS SQL Server Native client 10". This is the one you need to use.
    Another work around is to use ODBC, it seems to resolve all issues, but the client must be installed.
    Thank you
    Don

  • Reports quit working after upgrade to SQL Server 2008

    Folks,
    I'm running Visual Studio 2008 (sp1) and recently upgraded to SQL Server 2008. Reports worked fine until after upgrade. Now I get the "Login Failed" error message.
    Here is code snippets:
            CrystalDecisions.CrystalReports.Engine.ReportDocument oReport = new   CrystalDecisions.CrystalReports.Engine.ReportDocument();
            TableLogOnInfo LonOnInfo = new TableLogOnInfo();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            private Tables crTables;
            private Table crTable;
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
                crConnectionInfo.IntegratedSecurity = true;
                crConnectionInfo.ServerName = Properties.Settings.Default.InstanceName + "
    Instance";
                crConnectionInfo.DatabaseName = "DATABASE";
                crTables = oReport.Database.Tables;
                for (int i = 0; i < crTables.Count; i++)
                    crTable = crTables<i>;
                    crtableLogoninfo = crTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    crTable.ApplyLogOnInfo(crtableLogoninfo);
                oReport.RecordSelectionFormula = xFormula;
                crystalReportViewer1.ReportSource = oReport;
    Has anyone had this problem? Any help would be appreciated.
    Terry

    CR 2008 does not support MS SQL 2008 yet, meaning we have not had time to test it completely and add it to our supported platforms.txt file.
    One thing I noticed is you are using trusted authenication:
    crConnectionInfo.IntegratedSecurity = true;
    Make sure you give access to all users, MS changed the security properties a lot since SQL 2005 and you can't simply log into any database now. If you have a DBA check with that person on how to configure NT Authentication or the Help file. You can also do a quick test and simply use MS SQL Server authentication to confirm if it's a user permission issue.
    Try creating a report that doesn't use Integrated Security, check the box off on your data logon prompt in the Designer.

  • Inserting data from Oracle to SQL Server 2008

    Hi All,
    I am using oracle 9.2.0.7 and SQL server 2008 in windows server 2003 operating system.
    My requirment is like below.
    1) I would liek to insert data from the Oracle database to SQL Server.
    For the above requirement we have created the ODBC, then configure the listener file, tns file, and created the db link. This part is working fine as I am able to select the data from the SQL Server.
    But when I am inserting the record from the oracle database to the SQL Server I am getting the error, (ORA-00904) Here oracle can not identified the column name.
    My insert statement is like below.
    insert into test@SQLTEST (name, fullname)
    values ('Oracle', 'Oracle server data');
    Test is the SQL server table name and sqltest is the db link name.
    If I am select the data
    select * from test@SQLTEST from Oralce I am getting the data properly.
    Thanks,
    SUN
    Edited by: User SUN@ on Jun 9, 2010 5:49 PM

    Hi,
    I modify the column name as "f_name" and "l_name";
    Still I am getting the same error;
    Thanks,
    SUN

  • Export to text file cuts off data...

    I have a report that contains fixed width formuals that are in a text box.  The data is 496 char wide.  It will preview fine in a small font - but when I export to a text file it re-sizes the font to courer new 10 and cuts off data after 80 char.  Any ideas?

    hi
    as per my experience crystal has got some weird limitation in export.
    AG

  • Insert data from SQL Server 2008 St.Ed to ORACLE 11gr2 St. Edition

    Dear all,
    I'm searching a solution for faster transmission of data of a db SQL Server (2008 St. edition) vs PROD db that is an ORACLE 11gr2 St. edition too.
    Actually this operation spend 1,5 hours but I'd like cut this time because size of the data grow up in future and this time could be a serious problem ....
    Looking on Oracle Enterprise Manager I've seen that main problem is about commit .. SQL Server every record insert into Oracle TBL generate a commit  ... unfortunately I cannot insert when commit must be done ... If will be solved it probably may be solved situation ...
    Thanks in advance for every idea.
    Andrea

    Nardo wrote:
    SQL server is connect with Oracle DB by OLEDB, commit every record is why SQL haven't possibility of manage it ... anyway I'm sorry for delay of the answer, I've solved using sqlloader ... faster and without impact ... must be have hight attention if there will be change any field ... that's all.
    REDO upgrade was done like first step because anyway it was too small.
    Thanks for you answer and sorry again for delay !!!!
    Thanks.
    If you are depending on MS SQL server technology to do this, you are going to be stuck with the performance of that technology.
    A few weeks ago we had a need to load institute a daily load of or DW from a MSSQL database.  The MS-centric person responsible developed a procedure (using MS tools) that took 4.5 hours to load 1.2 million rows.  I ran a session trace and the tkprof report revealed exactly what has already been described.  Single row insert and commit.  I knocked together a PL/SQL procedure that did a single INSERT .. (SELECT .. FROM TABLE@MSSQL). and it ran in 4 minutes.  Using the Oracle transparent gateway for ODBC.

  • CFQUERY results return a null value for a varchar(MAX) field in SQL

    I'm using ColdFusion 9 and SQL Server 2008.
    One the fields in a table is defined as a varchar(MAX). Other fields in the table are ints, varchar(8000) varchar(256), etc.
    When doing a query for records in the table and displaying the results using the cfdump tag, I see values in all fields in a row EXCEPT for the data in the varchar(MAX) field. The varchar(MAX) field shows a null value.  Yet, I can verify through the SQL interface or through Microsoft Access querying the database that the varchar(MAX) fields have data.
    How can I retrieve data from this field type?
    Thanks in advance for your help.

    I'm wrong. I AM getting query results, but not what I expect. I had maxrows set as a variable in my original query, so when it returned 5 rows, the first row always showed as [empty string]. I've tried numerous queries now (where UID >100, where UID >200, where UID> 300, etc.) When I use <CFDUMP> to return the query, the first records always shows empty strings.
    Here's an example of some records retrieved from this simple query:
    <CFQUERY NAME="BuildBack" DATASOURCE="STORBASE">
    SELECT *
    FROM CallUnit
    WHERE CCU_ID>172
    </CFQUERY>
    Any ideas?
    173
    P
    tuse
    322
    340
    174
    E
    323
    340
    175
    P
    tuses.
    324
    341
    176
    E
    325
    341
    177
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupC
    326
    342
    178
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCa
    327
    343
    179
    E
    328
    344
    180
    E
    329
    345
    181
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_
    330
    346
    182
    P
    331
    347
    183
    E
    332
    348
    184
    P
    333
    349
    185
    P
    tuses.SCStat_ID)
    334
    350
    186
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Prior
    335
    352
    187
    E
    336
    353
    188
    P
    337
    354
    189
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Priorities.SCPriority_ID) LEFT JOIN SupCall_CommTypes ON SupCall_MetaData.CommunicationType = SupCall_CommTypes.SCComm_ID) INNER JOIN SupCall_CallStages ON SupCall_
    338
    355
    190
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Priorities.SCPriority_ID) LEFT JOIN SupCall_CommTypes ON SupCall_MetaData.CommunicationType = SupCall_CommTypes.SCComm_ID) INNER JOIN SupCall_CallStages ON SupCall_M
    339
    356
    191
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_
    340
    357
    192
    P
    tuses.SCStat_ID) á àh\  (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Priorities.SCPriority_ID) LEFT JOIN SupCall_CommTypes ON SupCall_MetaData.CommunicationType = SupCall_CommTypes.SCComm_ID) INNER JOIN SupCall_CallSta
    341
    358
    193
    P
    tuses.SCStat_ID) á àh\

  • How to cut off data use on a line in a family share plan?

    Is there a way to cut off data useage on one line in a family share plan? I have one person that is going over and want to simply cut off the data use after she reaches say 110% of her use in the billing cycle.

    I agree get Family Base and charge then the extra $5 it will cost since that person doesn't seem to understand the concept of SHARING. Or up the data plan and charge the extra to them and tell them since you had to increase the data plan because them they can pay the extra mount.

  • Query to get the a/r receivables based on a cut-off date

    I would like to ask assistance on how to create a query to display a/r receivables using a cut-off date. Example, today is 05/07/2014, I want to display  a/r posted from Jan. 1 2013 up to Dec. 31, 2013 that are still unpaid  as of April 30, 2014.

    Hi,
    Try this:
    eclare @Cust as nvarchar(20)
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    declare @Group as nvarchar(20)
    set @cust = (select max(t0.cardcode) from OINV t0 where t0.cardcode = '[%0]')
    Set @FromDate = (Select min(t0.Docdate) from dbo.OINV t0 where t0.Docdate >='[%1]')
    Set @ToDate = (Select max(t0.Docdate) from dbo.OINV t0 where t0.Docdate <='[%2]')
    set @group = (select max(t2.groupname) from OCRG t2 where t2.groupname = '[%3]')
    SELECT [CustName] as CustName, [G] as CustGroup,[1] as Jan,[2] as Feb,[3] as Mar,[4] as April,[5] as May,[6] as June,[7] as July,[8] as Aug,[9] as Sept,[10] as Oct,[11] as Nov,[12] as Dec
    from
    (SELECT T0.[CardName] as CustName, sum(T0.[DocTotal]) as Total, datepart(mm,T0.[DocDate]) as week, t2.groupname as G  FROM OINV T0   left JOIN OCRD T1 ON T0.CardCode = T1.CardCode left JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode   WHERE year(T0.[DocDate]) = 2013 and T0.[CardCode] = @Cust and  T0.[DocStatus]  ='o' and T0.[DocDate] between @fromdate and @todate and t2.groupname = @group GROUP BY T0.[CardName],T0.[DocDate],t2.groupname
    union all
    (SELECT T0.[CardName] as CustName, -sum(T0.[DocTotal]) as Total, datepart(mm,T0.[DocDate]) as week,t2.groupname as G  from ORIN T0  left JOIN OCRD T1 ON T0.CardCode = T1.CardCode left JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode   WHERE year(T0.[DocDate]) = 2013 and T0.[CardCode] = @Cust and  T0.[DocStatus]  ='o' and T0.[DocDate] between @fromdate and @todate and t2.groupname = @group  GROUP BY T0.[CardName],T0.[DocDate],t2.groupname )) S
    Pivot
    (sum(S.total) For WEEK IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
    Thanks & Regards,
    Nagarajan

  • Field Cutting Off Numbers

    I am having trouble with a field cutting off most of a number when 0.00 is present. The field is named FL025, and pulls information from an outside source. It is right-justified with a 10 digit character limit. It is formatted as a number. This exact same field on other forms works perfectly. I cannot figure out why it keeps cutting off most part of the number on this one. It isn't the field size, no matter how big I make the field, it still cuts off the numbers and half a zero is all that shows, or perhaps it's a parenthesis. I'm not sure. See clip below.

    We are trying to help you find the problem. There maybe some issue with the format you selected. The suggested change is for testing and observation only. This is part of the debugging process. You could also use JavaScript to examine the field, but I do not think you can do that.
    Normally the parenthesis do not display for zero unless the value is a negative number smaller than the amount the field is formatted to display and it is possible to enter a digit with more than 10 digits especially for decimal values.
    An image does not provide much information. Many computer programs have data in a different format than what is displayed.
    Can you post a link to a sample form with the data?
    If the data supplied is formatted with currency symbols and a thousand separator the 'Number:" format will not display it properly. The number format only accepts the numeric digits, a leading sign, and a decimal point. The decimal [point might also need to be the "." and not ",". If it is a "," there maybe a script in the other forms that make the correction when the outside source is quired.
    What version of Acrobat are you using? Database access has been removed for Acrobat forms but remains for LiveCycle forms.
    Is the form being populated by a direct data connection or through some other software?
    Have you tried talking to your companies IT support?

  • Separate month end cut-off date

    Hi,
    I have 2 companies in a same clients.
    These 2 companies would like to have separate month end cut-off date.
    Please advice how to do it in OB29.

    Hi,
    You can do so.
    You need to define two different posting period variant, where in the first one, for each month define the end date.
    SAy if you define month 01 date 28 as period 01 and month 02 date 26 as period 02
    Then period 02 will be from 29 jan to 26 feb.
    Then assign these posting period variants to your company code in OBY6.
    In that way you can differ the period end for two company codes.
    Regard,
    Gaurav

  • Process chain - cut-off-date

    Hi guys,
    in the process chain I have to check if today is cut-off-date. If it is the case process should continue if not it should be canceled. How can I do it. At first I wanted to use decision, but I think I should use ABAP in this case.
    Thank you in advance
    Regards
    Erwin

    Hi,
    Just write small ABAP Code and check the Date and then based on that Raise Event, you schedukle this program everyday, so it will check the Date and then it will trigger Event, if condition is not satisfied then EXIT.
    And give this event in Process Chain.
    Check similar kind of thread, but you need to change the logic.
    Re: Stopping one process chain when another is running
    Thanks
    Reddy

  • I have a 5.1.1 3GS phone that cuts off calls after about 3-4 mins, and goes to the apple logo, the phone then resets to login after a further 1 min. Any suggestions

    I have a 5.1.1 3GS phone that cuts off calls after about 3-4 mins, and goes to the apple logo, the phone then resets to login after a further 1 min. Any suggestions

    You have outdated iOS software so without upgrading it first there is little you can do.   A restore will force you to upgrade as 5.1.1 is no longer signed.

  • Data Committed instead of Rollback after Deadlock Error in SQL Server 2008 R2 (SP2)

    We're having a strange issue which is occurring only with one Customer having SQL Server 2008 R2 (SP2).
    Basically we have multiple threads uploading data and when an error occurs (like deadlock or any other error). The deadlock victim (process/transaction) is rolledback (from .NET). However the rollback command is not reaching SQL Server as it doesn't show
    in the trace (through SQL Profiler).
    To make things worse, not only the transaction is not being rolled back but the INSERTs executed before the error are being somehow committed, leaving the database in an inconsistent state.
    This is only produced in one environment.
    Any idea what the issue could be?

    All statements are executed with in a Transaction. Under the same scenario this code works perfectly fine for 1000s of customers. Only one customer has this issue.
    You need to capture profiler to check transaction scope.
    Balmukund Lakhani
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog |
    Team Blog | @Twitter
    | Facebook
    Author: SQL Server 2012 AlwaysOn -
    Paperback, Kindle

  • Inserting Data from Oracle to SQL Server on the Real Time Basis.

    Hi Everyone,
    I need to insert data from Oracle to SQL Server on the Real Time basis, we have to fetch data from oracle approx 20 tables, and each table has more than 30 Fields. I need to fetch data in every 15 mins.
    I have created a job using SQL SERVER Agent by writing insert queries for all the tables with conditions that no rows will be inserted which is already in SQL. note that this job is taking only 1 min to execute.
    But in this way our SQL Server getting hanged and it giving problems to other application running in the SQL SERVER.
    So i m requesting all of you that what is the best way to insert huge amount of data on the real time basis.
    Thanx in Advance.

    1) Create Linked server 
    2) insert data using openquery  and set job in sql agent
    3) run job after 15 minutes

Maybe you are looking for