I have the following sp that uses a scalar function to get the cost of a product
The procedure calculates profit of each bill,and using two tables
1 - Estimate Header
2- Estimate details
For each estimate invoice sp will compare items profit by comparing items rate with the rate it is purchased.I use a Scalar sql Function to get the Purchase Cost of each item in an invoice.This fuction cause the slow execution
Can this scalar function be replace with something else to get this sp execute faster....now it taking around 25 seconds there is only 1100 invoice in the database.
select BillNumber,sdate [Date],case when t1.Customer = 0 then 'Account Payable' else t2.AccountName end Customer ,case when t1.CashOrCredit = 0 then 'Cash' else 'Credit' end CashOrCredit,(select Sum(gross) from EstimateDetails where billNumber = t1.BillNumber)Gross,t1.netDisc,(select sum(TaxAmt) from EstimateDetails where billNumber = t1.BillNumber)Tax,t1.Ces, Amount,t1.roundOff,Paid Payment,
I have problem with a stored procedure and function that return the same shape, but as they are different methods LINQ won' t let me cast between the two. Please see code for the two SPROCs below (This is actually simplified to represent the problem, so please don't spend lots of time explaining alternative ways of writing the function/sproc.)
Table Valued Function "getCategories()" SELECT categoryName, categoryID FROM categories SPROC "getUnusedCategories" SELECT categoryName, categoryID FROM CategoryInstances cI FROM dbo.SMAN_getCategories(@SiteMANID, @SectionID) c LEFT JOIN @EntityResultsTable er
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?
I am trying to write a function that can be called to run a stored procedure. I pass the stored procedure name, followed by as many parameters as I need to run the procedure. I am able to do this by using the params keyword, so my function looks something like this;
[Code]....
How can I determine what the data type of the parameter is? Maybe I need to alter the string[] part, above?
how 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 !
I have this import function which can be changed by the client in his desired way.Now I want to code such that if the client tries to import his own data on the page and doesnot give the tags in the order mentioned below his import function should be stopped.
It shouldn't make any changes unless the tags are in the right format because the problem now is if the tags are not in the right format when client changes then its importing over the existing files and directing to an error page which I dont want it should simply stop the import function if they are nt in the order.the code for this function is below
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 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 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
The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.
On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.
I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.
Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?
I have migrated a database from one server to another and following the migration had an orphaned user (WholeSystem_webuser), which has been fixed using the auto_fix option of sp_change_users_login •The WholeSystem_webuser account is used by ASP.NET pages to connect to the database and run stored procedures.
•I can log in to Management Studio as WholeSystem_webuser OK and execute the sp's from there •When I try to run my ASP.NET page it was saying “Can’t find stored procedure [procedure name]” •If I drop the sp and create it as [dbo].[GetContactsCount] instead of [WholeSystem_ webuser]. [GetContactsCount] it says “The EXECUTE permission was denied on the object 'GetContactsCount', database 'WholeSystem', schema 'dbo'.” (which is what I’d expect as the connection string is using the WholeSystem_webuser account??) –does that show that the web user is logging into the database OK?? •If I try and configure the SqlDataSource in VWD to see what it is looking at though, it won’t let me get beyond the connection string window and says “Default schema could not be retrieved for this connection” •I tried setting up a new login/user/connection string but still get the “Default schema could not be retrieved for this connection” error
IN SQL Server: •Users mapped to the login WholeSystem_webuser - WholeSystem_webuser, default schema dbo •User WholeSystem_webuser has default schema dbo and db_dataread and db_datawrite permissions •There is a schema dbo whose owner is dbo, and a schema WholeSystem_webuser whose owner is WholeSystem_webuser
I have stored procedure in my database but its give error "Could not find stored procedure"Is this error occuring when maked error in permision,sp code or connection code
I am trying to re-write an existing asp.net website using MVC with Linq to SQL. A page we have is used to insert new contracts and uses usp_contract_insert to insert a new contract into t_contract as well as t_project. On my dbml file i have dragged t_contract on and then I try to drag usp_contract_insert on top of that and I get the error :- Microsoft Visual Studio
One or more selected database objects return a schema that does not match the schema of the target data class. Nothing has been added to the designer. The stored procedure returns the id of the last project which was inserted. I don't quite follow this and unsure how to go about hooking my Controller up using Linq to SQL to call this stored procedure