Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

nvarchar - Handling larger strings in Sql Server 2008 -


we have stored procedure created user can write comma separated search tags in software product's admin. can add comma-separated tags , in case if wants edit them, read table tags, recreate them comma-separated values (csv) in stored procedure , returns calling code. happened recently, user complained not see new csvs wrote. looked , found out stored procedure truncating string when reads values database , creates csv string. string of type nvarchar, , because exceeding max characters of 4000 limit, values gets truncated. ideas on how work out problem.

find code underneath.

begin begin      declare @synonyms table     (         rowid int identity(1,1),         synonymid int,         [synonym] nvarchar(4000)     );      set nocount on;      insert @synonyms(synonymid, [synonym])     select distinct synonymid, [synonym] rf_searchsynonyms with(nolock) searchtermid = @searchtermid , activeind = 1      if((select count(rowid) @synonyms) <> 0)     begin         declare @currentrow int = (select min(rowid) @synonyms),                 @totalrows int = (select max(rowid) @synonyms),                 @synonyms_csv nvarchar(4000) = '';           while @currentrow <= @totalrows         begin             declare @tempsyn nvarchar(500);             select @tempsyn = [synonym] + ',' @synonyms rowid = @currentrow;             set @synonyms_csv = @synonyms_csv + ltrim(rtrim(lower(@tempsyn)));              set @currentrow = @currentrow + 1         end     end     else     begin         set @synonyms_csv = '';     end end  begin     declare @skus table     (         rowid int identity(1,1),         skuid int,         sku nvarchar(15)     );      set nocount on;      insert @skus(skuid, sku)     select distinct skuid, sku rf_searchskus with(nolock) searchtermid = @searchtermid , activeind = 1      if((select count(rowid) @skus) <> 0)     begin         declare @currentrow1 int = (select min(rowid) @skus),                 @totalrows1 int = (select max(rowid) @skus),                 @skus_csv nvarchar(4000) = '';           while @currentrow1 <= @totalrows1         begin             declare @tempsku nvarchar(15);             select @tempsku = sku + ',' @skus rowid = @currentrow1;             set @skus_csv = @skus_csv + ltrim(rtrim(@tempsku));              set @currentrow1 = @currentrow1 + 1         end     end     else     begin         set @skus_csv = '';     end end  begin     declare @combined varchar(8000),             @syn_len int = 0,             @sku_len int = 0;      select @syn_len = len(@synonyms_csv);     select @sku_len = len(@skus_csv);     select @combined = @synonyms_csv + '-_-' + @skus_csv;      select @synonyms_csv + '-_-' + @skus_csv; end 

end

i can't use text , ntext not play nice concatenation operations.

thanks.

how declaring string parameter?

nvarchar(max) 

supports 2^32-1 (2gb)

see link.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -