.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
satyapriyanayak
SP
abhays
Sasi Prabhu
Post New Web Links

Searching a NVarChar Column with multiple wildcards returns all rows

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :ASP.Net
 
I'm building a stored procedure to return a set of records, yes nothing big. The column is an NVarchar column and I'm using a select statement of Select * from Table1 where Column1 Like @Column1 Table is currently one record containing the words:  ***Some Test Word***  Is my test word I've set the value of @Column1 to: Some - no records returned Some% - no records returned %Some% - 1 record returned  % - 1 record returned *% - no records returned %*% - 1 record returned %Not Here% - 1 record returned   Can someone tell me why if I have a leading and trailing wildcard I will get all records returned?  Does it have something to do with the '*' characters in the field because some of my users are using these characters. I've also tried changing the select to: where RTRIM(Column1) Like @Column1 with the same result and where RTRIM(Column1) Like N'%' + @Column1 with the same result   What way should I give a user the way to search for a substring inside of an NVarchar field? Oh, I tried using the Substring function and got the same result. Thanks Mike    


View Complete Post


More Related Resource Links

Infopath 2007 Repeating Table - Multiple Value Column Text - Hiding Rows based on Column text values

  
Infopath 2007 browser based form Full Trust Example: I have a repeating table (FruitChoice) that has multiple columns. Both drop down list point to sharepoint list data sources. Choose your tree ft. drop down list – 6Ft Choose your Department drop down list - 103 This repeating table is conditional on the drop down values. This works great. Trees     Fruit       Cost   Date Ordered    Date Delivery Department 6Ft        Peaches                                                        103 3Ft        Apples                                                          102 3Ft        Peaches         &

Concatenating column values for multiple rows

  

I know this question has been asked many times. I am just trying to verify that my solution is correct.

I need to concatenate a column values with the rows being ordered on another column.

I initially used the FOR XML PATH clause for the purpose, and it worked wonders, until I had XML entities (&, < etc) in my data, and FOR XML PATH encoded those. After some searching on experts-exchange, I came up with the following code for myself:

	SET @freeFieldXml = '';
	SELECT @freeFieldXml = @freeFieldXml + '/' + Value FROM @fields ORDER BY CodeType;
	SET @freeFieldXml = STUFF(@freeFieldXml, 1, 1, '');

In my testing, the above code worked perfectly. I just want to confirm that the data would always be sorted on the desired column and the concatenated string would actually have the field values sorted by that column.


I always think tomorrow will have more time than today. And every today seems to pass-by

Select Primary Key Column of Table returns 0 rows

  

I have three tables: Design, Box, Wall.

Design has a column DesignId that is a GUID. It does not allow nulls, is unique, and is the primary key. The identity is set to false for compatibility with Entity Framework v4.

Box has  a column BoxId that is a GUID. It does not allow nulls, is unique, and is the primary key. The identity is set to false as well.

Box also has a column DesignId that is a GUID. It does not allow nulls, is not unique and is not the primary key.

Wall has  a column WallId that is a GUID. It does not allow nulls, is unique, and is the primary key. The identity is set to false as well.

Wall also has a column DesignId that is a GUID. It does not allow nulls, is not unique and is not the primary key.

Wall also has a column BoxId that is a GUID. It does not allow nulls, is not unique and is not the primary key.

Box.DesignId has been set as a ForeignKey relating to Design.DesignId.

Wall.DesignId has been set as a ForeignKey relating to Design.DesignId

Wall.BoxId has been set as a ForeignKey relating to Box.BoxId.

 

If I execute      SELECT DesignId FROM Design     I see the correct number of rows.

If I execute     SELECT BoxId From Box        I see zer

How to list comma separated values in column to multiple rows

  

Hi,

 

I need to list comma seperated values form one to column in multiple rows..ex:

id                           call_rec 

1                            508190,737079,1004618,1075562,1272753,1390841,1544201,2591141

 2                           335395,359380,741049,1113212,2283999,2908851,2001205615 

3                            1212358,2451853,2795175,2001196872 

4                            2283999,2451853 

I want the call_rec for each bug ID to be listed

ex:

id                    

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

Multiple Column Dropdownlist for the ASP.NET DataGrid

  
Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

>>>How to update multiple rows of gidview by one click

  

Hi,

I want to add multiple rows of a gridview if the data for multiple fields are same.

Idea for this is that a user may search a record with some parameter e.g. Sector, plot.

For example 15 records being displayed in gridview.

There should be checkbox before every row and if user wants to update Plot and Flat No that is same for 10 rows out of 15 so he will check the rows and update.

For this a dialog box should appear asking for the parameter i.e. Plot and Flat or something else next time may be it will be City or country. Moreover, there is already an Edit button to update records, when user click it another page open for the record to be updated and whatever he wants to update, it updates.

Hope everone understand the scenario.

I don't want to disturb the already provided Edit functionality and want to provide same record to be updated.

Any idea in this regard would be appreciated.


Bug: Does not change column type from nvarchar to ntext

  

Scenario: If you create a table with a column of type nvarchar, populate it with some content and try to modify it using the WebMatrix editor, from nvarchar to ntext, it does not display any error message or warning that this is not possible. It silently saves and reverts the change, back to nvarchar. Wasted some hours on this issue as I thought my column was ntext, but in fact was still nvarchar.

Expected behavior: It should change to ntext, or if SQL CE doesn't support that, it should notify the user that no change was applied.


Picker returns nothing for BDC column in custom list

  

Playing with the BDC for the first time, running into some issues adding a Business Data column to a custom list.

I believe my ADF file is solid. I've been able to import that just fine and can use the application to drive various BDC-specific webparts (a Business Data List or Business Data Item, for example). It also seems to work when I manually enter information in my NewForm.aspx field and click the Check Names button (it verifies my entry and underlines it, creates link to profile when I view the list data).

But...

If I try to use the picker, I get nothing. Enter a name I know is valid or a % and click the magnifying glass icon and I very briefly get the "Please Wait" message, then just an empty set with "Type into the search box above then press "Enter" to start your search" where my results should be.

Any pointers? Thanks.


Configure BDC column to have multiple values selected

  

How do I Configure BDC column to have multiple values selected and make multiple entities data available in the same column.  Currently it supports only single value for an item.  This requirement is crucial need some solution immediately.


BDC Column with Ability to Select Multiple Values

  

Use Case:

We are creating a storage location for technical product articles. These will be SharePoint publishing pages. Each page will have metadata assigned to it to make it searchable by properties. The possible values for one of the columns (Part Number) could potentially be sourced by our ERP system. I'd like to do this to eliminate the possibility of free-text entry errors, but there are probably over 10,000 parts so a drop-down list isn't feasible.

 

Ideal Situation:

The end user enters the part number and clicks a button to verify it against a BDC entry from our ERP system. If they weren't sure on the part number they needed, they could do a lookup from that metadata entry screen. They'd need to have the option to add multiple part numbers as one technical product article could reference multiple part numbers.

 

Question:

Is BDC an option for all of this or am I looking at a custom metadata solution? I thought I heard along the way that BDC only supported one value choice, but I couldn't find a verification for that in the forums.

 

Thanks.


How to get character count in 'Multiple Text 'column using Calculated Column?

  

Hi All,

I have a multiple text box in a list

I want

  • A column which lists number of characters in multiple list column example 188, 199 etc
  • Multiple character column must not have more than 200 chars
Is this possible?

Appreciate all the help!

-saumil


Sharepoint: In Calculated Column, Code with multiple "IF" condition does not work.

  
Implemantation:  Calculate expected resolve date exclude "Saturday" and "Sunday"  based on Priority and Severity.Columns are:1. Priority:2. Severity:3. Raised on: Date record createdCode: Below is the code which contains multiple "If" conditions. For quick undersatnding, i separated major If condition. Below code does not work and sharepoint gives me Sytax error message. =IF(OR(Priority="Critical",Severity="Critical"),IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+3,[Raised on]+1),     IF(OR(Priority="HIGH",Severity="HIGH"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+4, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+4,[Raised on]+2)) ,   IF(OR(Priority="MEDIUM",Severity="MEDIUM"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+3),"dddd")="Saturday",[Raised on]+5,[Raised on]+3)) ) ,   IF(OR(Priority="LOW",Severity="LOW"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+6, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+6, IF(TEXT

can i use nvarchar(300) for a column having records as website links?

  
Hi guys, small question. is it good to use nvarchar(300) for a column having records as website links. i was told the size may exceed 255 characters. so just thinking is it possible?
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend