Tag stored-procedures

[Solved] This procedure not working

The problem is not at the procedure it is at the calling. When you call the stored procedure, you need to declare and pass in the required parameter declare @NAME VARCHAR(50), @CITY VARCHAR(200), @MOBILE NUMERIC(20) execute GETDETAIL @AGE = 21,…

[Solved] How to convert the Varchar of sum to time using sql server 2008 [closed]

Try this: DECLARE @SUM VARCHAR(50)=’33.90′; SELECT CAST(CAST(LEFT(@SUM,CHARINDEX(‘.’,@SUM,0)-1) AS INT)+ CAST(SUBSTRING(@SUM,CHARINDEX(‘.’,@SUM,0)+1,LEN(@SUM)) AS INT)/60 AS VARCHAR(10))+’.’+ CAST(CAST(SUBSTRING(@SUM,CHARINDEX(‘.’,@SUM,0)+1,LEN(@SUM)) AS INT)%60 AS VARCHAR(10)) result: 34.30 1 solved How to convert the Varchar of sum to time using sql server 2008 [closed]

[Solved] Stored Procedure in sql server 2005

Well, the error you are getting doesn’t really have anything to do with stored procedures, but I can answer the question of “how to solve this?” in the context of the exception you are getting. First, I hope you are…

[Solved] Why is this cursor giving an error?

Given an input XML, you can use this simple XQuery statement to “shred” the XML into relational rows and columns – just do a simple INSERT INTO ….. and you’re done. No messy cursor nor OPENXML stuff needed… DECLARE @input…

[Solved] SQL Server 2008 R2 stored procedures

Try passing null value for unused parameters and inside the stored procedure put a check for nulls to switch tables. CREATE PROCEDURE [dbo].[proc_search_patient_ByID] ( @PatID_pk int , @Cntid smallint, @FamID int ) AS SET NOCOUNT ON IF @Cntid IS NULL…

[Solved] Postgresql switch query to function

Just make it one: create function ops() returns table (region varchar, man integer, woman integer, test integer) as $$ Select region,man, woman, Case When woman > man then woman – man When woman < man then man – woman ELSE…

[Solved] if between 10 variable [closed]

You need to use dynamic SQL and generate the sentence. Check out this link. Pay special attention to section Using sp_executesql. Something like that is almost exactly what you need. 2 solved if between 10 variable [closed]

[Solved] Place to store PL/SQL block [closed]

As Ranzo notes several of the other answers are are also plausible. So, why is E the correct answer? Because the question asks for the most appropriate location for the code. Let’s break it down. The logic needs to be…