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

Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Post New Web Links

use function in select

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :Sql Server
Hi Guys. I used an function in select statement. the select return 3 rows but the function return same value in this 3 rows.(the value of first row) may u help me. 01.declare @id_TD int; 02.select @id_TD = 2 03. 04.select idTo,sum(payCost),dbo.udfMyFunc(@id_TD,idTo) from wallet 05.where idFrom = @id_TD 06.group by idTo 07.order by idTo best regards. morteza

View Complete Post

More Related Resource Links

use function in select

Hi Guys. I used an function in select statement. the select return 3 rows but the function return same value in this 3 rows. may u help me.declare @id_TD int; select @id_TD = 2 select idTo,sum(payCost),dbo.udfMyFunc(@id_TD,idTo) from wallet where idFrom = @id_TD group by idTo order by idTo Best Regards. Morteza 

Use of PATINDEX function in select clause With Linq

hello       i have an problem to use of PATINDEX function in select clause with Linq.      if anyone have any clue about it then please update me its urgent.Thanks In Advance.

Error: "Select statements included within a function cannot return data to a client"

hi all, Not sure if there is an easier way to do this but this is my first ever Function I created so far. I am getting the error: "Select statements included within a function cannot return data to a client" All I am trying to do is ...if the date is NOT passed then apply NULL as the default value and run the SELECT statement. If the date IS NOT null then run a different SELECT statement. CREATE FUNCTION [SchemaTest].[fn_Test] ( @instance as uniqueidentifier ,@date as datetime = null ) RETURNS varchar(8000) AS BEGIN If (@date is null) --@date = null ?? Begin Select * From Uds.RealtimeLogging Where instanceID = @instance End Else Begin Select * From Uds.RealtimeLogging Where instanceID = @instance and [timeStamp] > @date End Return @stepIds END Thank you!JCD

Table Valued Function in the select statement


Hi, I have created a table valued function

dbo.FnTaskGrp(@p1 int,@p2 datetime)..

I got the result by executing,

SELECT * FROM dbo.FnTaskGrp(1,'1-jan-2010')

But For this ,

select * from dbo.FnTaskGrp(tab.WflTask,tab.WflModDt)

                  select WflTask,WflModDt from WorkFlow


I got the Error,

Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'from'.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'tab'.

Isn't Possible in SQLSERVER 2005?









Query table from within CLR function where the db user has not select right on the table


I have written a CLR scalar valued function that queries a table using the context connection. This is working fine as long as the db user has select right on the table that is queried from within the CLR function. If the db user has no select right on the table I am receiving the following error:

The SELECT permission was denied on the object '...', database '...', schema 'StD'.

I do not want to give the user select right on the table. How can I allow the CLR function to query the table without granting select right to the db user?

I have created the assembly with PERMISSION_SET = SAFE. Do I have to apply PERMISSION_SET = UNSAFE or is there any other way?

Thanks and kind regards
Sebastian Daser
Softfount IT Solutions

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

Select value in gridview


Hi, I am new to gridview. I want to make a gridview. Its row when selected should direct me to a specific .aspx page.Each row should direct to a different page. Should I use querystrings for this? Please suggest. Regards, ap.

Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly.


I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.

 I have two SQL Server instances installed.

 1- UserLT (this is sql 2000)
2- UserLT\SQL2005 (this is SQL 2005 named instance)

But when i try to add a database to my VS website project I get the following error:

Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)

and changed the "SQLEXPRESS" to "USERLT\SQL2005".

But I still get the same error message. Any ideas how i can resolve this issue?

Public Shared function doubt????

I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

I am confused here. Is it the right way to go?

Please advice. Thanks in advance.


Trim function in C Sharp

How do i use "trim" function in C Sharp? I have a string and i want to strip off spaces from the end of the string. Any idea how do i do it??


Pure C++: Invoking Generic or Function Templates


As I promised last time, in this month's column I'll walk through the process of defining and invoking a generic or template function under C++\CLI. A function template or a generic function begins with the template or generic keyword followed by its parameter list.

Stanley B. Lippman

MSDN Magazine October 2005

The XML Files: XSLT Keys, Select vs. Match, Conflict Resolution, and More


This month Aaron Skonnard covers how keys work in XSLT, XSLT match and select attributes, SelectNodes order, finding