SQL Server :: Why This Stored Procedure Is Not Working
Mar 7, 2011CREATE PROCEDURE [dbo].[sp_Select_Project] @ClientID intASBEGINIF NOT EXISTS (SELECT ClientID FROM tbl_ProjectDetails WHERE ClientID= @ClientID) BEGIN
View 8 RepliesCREATE PROCEDURE [dbo].[sp_Select_Project] @ClientID intASBEGINIF NOT EXISTS (SELECT ClientID FROM tbl_ProjectDetails WHERE ClientID= @ClientID) BEGIN
View 8 RepliesALTER Proc [dbo].[Usp_CheckUserLogin]
(
@Username varchar(20),
@Password varchar(20)
)
as
begin
Declare @RowCount int
Declare @RowCount1 int
set @RowCount = (select distinct UsrId from UserMast where username=@username COLLATE SQL_Latin1_General_Cp1_CS_AS )
set @RowCount1=(select distinct UsrId from UserMast where [password]=@password COLLATE SQL_Latin1_General_Cp1_CS_AS)
if(@RowCount > '0' and @RowCount1 > '0')
if (@RowCount=@RowCount1)
begin
-- select U.UsrId,U.FirstName,U.LastName,U.Email,U.companyId,U.role,R.RoleName from UserMast U join rolemast R on U.Role=R.RoleId
-- where usrid=@RowCount
select 'success'
end
if(@RowCount > '0' and @RowCount1 = '0')
begin
select 'username exist'
end
if(@RowCount= '0' and @RowCount1 > '0')
begin
select 'password exist'
end
if(@RowCount= '0' and @RowCount1 = '0')
begin
select 'both not exist'
end
--return @RowCount1
end
my procedure not give me result i think my syntax is not correct
I could probably figure this out if I tried to, but I have been working so long on code, I'm a little fried
I have a stored procedure, and I want to execute another stored procedure during a time period of lets say 1/1/2011 to 12/31/2011
How Would I accomplish this?
[Code]....
i have a stored procedure with this values and i need just to make a button that will send something to "Equip" column,how to do it? write the values on my webpage and make a button to exec the procedu
I have created stored procedure and student database and also asp.net application for asp.net page but it could not found stored procedure what is the mistake actually I don't no
View 7 Replieshow can I create stored procedure and write my select statement in it, I know how to create dataset then put type stored procedure and assign it to the sp ... what I want is writing my sp... how can I make it ?
check the following code, this is what I want to write put I don't know where or how !
CREATE STORED PROCEDURE SP_CATEGORY
@CATEGORY VARCHAR(30)
AS
BEGIN
SELECT LATIN_NAME, ENGLISH_NAME, ARABIC_NAME, CATEGORY
FROM FLORA, CATEGORY_LIST
WHERE FLORA.CATEGORY=CATEGORY_LIST.CATEGORY_NAME AND CATEGORY_LIST.CATEGORY_NAME IN (SELECT * FROM SPLITLIST(@CATEGORY, ','))
END
where can I write this code ?!
I am trying to create the following stored procedure in sql server Lat and Lng are the parameters being passed from c# code behind .But I am not able to create this stored procedureit indicates with error saying undefined column name Lat,Lng
CREATE FUNCTION spherical_distance(@a float, @b float, @c float)
RETURNS float
AS
BEGIN
RETURN ( 6371 * ACOS( COS( (@a/@b) ) * COS( (Lat/@b) ) * COS( ( Lng/@b ) - (@c/@b) ) + SIN( @a/@b ) * SIN( Lat/@b ) ) )
END
sqlda.SelectCommand.CommandText = "select *, spherical_distance( Lat, 57.2958, Lng) as distance
from business
[code]...
i m creating simple project i want to update data in same page at registration...i have code to show you which is not working plz help mepublic void update(string fname, string lname, string address, string emailid, Int64 phoneno ,string id)
cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseConnectionString1"].ConnectionString);
cmd = new SqlCommand();
cmd.Connection = cn;
[code]...
I can't get SqlCacheDependency to work with a simple stored proc (SQL Server 2008):
create proc dbo.spGetPeteTest
as
set ANSI_NULLS ON
set ANSI_PADDING ON [code]...
And here's my ASP.NET code (3.5 framework):
-- global.asax
protected void Application_Start(object sender, EventArgs e)
[code]....
This is surareddy. i nead some small clarification in the "Stored Procedure"
how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.
right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.
how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure
Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?
View 4 Repliesi am using modalpopupextender and a listviewWhen the user click on an item in the listview it call a modalpopupextender.In that modalpopupextender there are 2 dropwn fill with datasource.When i click the ok button it call a stored procedure with 3 parameter.Nothing happen if i pass the dropdown SelectedItem.Value to the parameter but if i use a static variable the insert will work i don't know what i am missing.
View 3 RepliesDoes anybody if it is possible that a stored procedure returns rows which is the result of the execution of another sp? Something like..
[Code]....
i want to return output parameter from 1 storeprocedure. into another stored procedure.
View 7 RepliesServer Error in '/staff' Application. Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. Source Error:
[Code]....
Stack Trace:
[Code]....
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
I am trying to create a stored procedure that filters data from sql server by date but i get this error:
Conversion failed when converting datetime from character string.
my stored procedure is like:
[Code]....
the parameters are passed to the stored procedures as dateTime variables from c# code...
The following stored procedure updates the value in LeaveTransaction table.
[code].,...
My Question here:
I have written the above trigger,which would update the value for the corresponding records in another table ie) LeaveCumulative table. The trigger is not updating the value in the designated rows in the leavecumulative table. Whereas when I excute the same update command separately in the Query Editor window the trigger is working fine.
Here is my stored proc
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
Create PROCEDURE [dbo].[sp_GetNextSeq] (
@p_NextSeqNo int = NULL OUTPUT
)
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRY
BEGIN TRANSACTION
Generate Next Sequence Number
[code]...
I not getting the return value from stored procedure that I have written so how to get that plzz its urgent I have return the procedure as ALTER PROCEDURE [dbo].[sp_AddPaySlip]
View 2 RepliesI have upto 16 calculators(I mean 16 stored procedures) in one database.How do I log all inputs for each calculater(each stored proc)?.Most of the variables are not populated in the output table so it became hard to reproduce.The variables are not consistant across all the 16 procs . Do I need to set up new table for these inputs?
View 2 Repliestell me is it possible to use Switch Condition (case)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER Proc [dbo].[Usp_viewcart_test]
@cust_id int
[code]....
I was trying to write an SP with for loop inside...but not sure how to start...here is the scenario...
(Select Name, Email from Table
union
need to loop throug the first select statement and need to create a row with 'Gautam' as
Name, 'looped email id's separated by commas' as Email )
and show the output ....
Can anyone see why i get this error in my stored procedure?
ERROR:
[Code]....
STORED PROCEDURE:
[Code]....
how to write stored procedure for login? if username/password is wrong then how to handle that part in asp.net and viceversa?
View 5 RepliesI have a stored procedure being executed from an ASP.NET application. Is it possible to attach to the procedure and step through it using SQL Server 2005?
Note, in this instance, I am not using a DataAdapter. I'm going in blind. The connection string is being created on the fly, so I don't have access to the schema from the Visual Studio 2005 designer.
I was hoping for a solution similar, for example, to how you attach to a process on a remote server and when a break point is hit, the debugger fires.