How To Pass A List Of Values To Compare In A SQL Function In SQL Server 2008?
Feb 18, 2010
I have an SQL Function with the following SQL within:
SELECT StockID FROM (SELECT DISTINCT StockID,
ROW_NUMBER() OVER(ORDER BY DateAdded DESC) AS RowNum
FROM Stock
WHERE CategoryCode LIKE @CategoryID) AS Info
WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1
I have a Parameter @CategoryID - however I need to take in a category ID such as "BA" and translated this to a list of Category IDs such as "IE","EG" etc so my WHERE clause looks like:
WHERE (CategoryCode LIKE 'IE' OR CategoryCode LIKE 'EG') AS Info
I have a Lookup Table which contains the "BA" code and then all the real category codes this means such as "IE" and "EG".How do I have the CategoryID expand to multiple "OR" statements in my SQL Function?
At the moment the query as shown can cope with one CategoryID such as "IE", this is done as I want a category page such as category.aspx where a parameter "BA" is passed such as category.aspx?category=BA and this page will list all items with the category codes "EG" and "IE".
The reason I need this is there is a "parent" category code which has multiple "children" category codes which are different to the parent code. I am using ASP.NET and .NET 3.5 on the front-end if this helps.
In one of my stored procedure I have to compare two nvarchar datatype values.The values containing both numerical and characters.Which function should I write? And one more problem i.e if a number containing zeros in starting ,I should also match including zeros.But not omit zeros.
I have 2 views(2 view pages) in first view page I will display some names in this page i will have add button after clicking on add button it will redirect to another page (2nd view page) in this i will display multi selected list or listview then i will select multiple items from multi selected list now this selected items has to bind with first view names and display updated list in 1st page?
My question is this selected items in 2nd view page has to bind with 1st view page and display how to do this using mvc razor for mobile application?
I think I need to drop in some escape characters, but I'm not quite sure where. Here is the javascript function I'm attempting to call:
function setData(associateValue, reviewDateValue) { var associate = document.getElementById("Associate"); var reviewDate = document.getElementById("ReviewDate"); associate.value = associateValue; reviewDate.value = reviewDateValue; }
Here is the asp .net mvc line where I'm attempting to create a Radio button with a click event that calls the above function and passes data from the model as javascript parameter values.
<%= Html.RadioButton("Selected", item.Selected, new { onClick="setData('<%=item.Associate%>','<%=item.ReviewDate%>' )" } )%>
The above throws a bunch of compile issues and doesn't work. A call such as the following does call the javascript, but doesn't get the data from the model.
I am working on asp.net mvc using linq to sql. I have to login my application only if the user registered (in register view page).I need to know how to compare the entered login and password values with registered values
How to get the date at which a record is created in SQL?..i.e, if i add a record to a database table db1 at 8/10/2010 11:30, I want to get the datetime, i.e 8/10/2010 11:30..;.Also let me know how to compare datetime values..
if(8/10/2010 11:30 >8/10/2010 10:30) will work or not?
I have created a view called business this runs sucessfully ,but the problem is how will i use dynamic values in place of 12.925432,77.5940171 ,I want to pass parameter in sql query from c# code behind.
create view [dbo].[business] as SELECT Id, Name1, ZipCode, StreetName, StreetNumber,
i have used PageMethods to access the server side functions in javascript , but now my problem is that with pagemethods your controls will not go throught the full page lifecyle and these leads me to have "Object not set for an instance of an object" error. Now can someone come with a differnt approach without using pagemethods. What i want is to call a server side function , i dont want to pass any parameters to it
im just testing out signalr and i am having too much fun and got a little bit far from my usual skill now my question is can i pass a list to the client here is my code actually i learned this from you mr aspsinnipets
Public Sub Send(message As String, id As String) Dim tomessage = OnlineUser.userObj.Where(Function(users) users.userId = id).[Select](Function(users) users.connectionId).SingleOrDefault() Dim customers As New List(Of locationslist) customers.Add(New locationslist) customers((customers.Count - 1)).CITE_NR = message
I have 3 dropdownlist with day,month(e.g Jan, Feb...) and year value. However I am getting an error from my code when trying to insert the concantenated values into a date field in sql server 2008.
I have a web form where there are couple of DDL's; DDL1 and DDL2 respectively. I want the DDL2 to be populated based on the selection made in DDL1. From the DDL1, I just want to extract the first three digits of the value selected in DDL1 and use it in the WHERE clause of SQL query which is used to generate DDL2.
My prob is that I am not able to extract the first three digits out of DDL1 and use it in the WHERE clause of DDL2. I have pasted all my code below:
Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim ddl1Value As String = DropDownList1.SelectedValue ddl1Value = (ddl1Value.Substring(0, 3)) SqlDataSource3.SelectParameters(0).DefaultValue = ddl1Value SqlDataSource3.DataBind() End Sub
I have two List's that contain a object of Tag like List<Tag> i need to find excluded and included to do an update operation how do find the difference in them both since they contain a Tag object. Can you use Contains function with a Tag object inside the list.