Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Kanne
Starting Member
2 Posts |
Posted - 2014-09-09 : 15:38:20
|
Hi I need to create a Stored Procedure in SQL server which passes 6 input parameters Eg: ALTER procedure [dbo].[sp_extract_Missing_Price] @DisplayStart datetime, @yearStart datetime, @quarterStart datetime, @monthStart datetime, @index int as Once I declare the attributes I need to create a Temp table and update the data in it.Please help creating temp table Once I have created the Temp table following query I need to run SELECT date FROM #tempTable WHERE #temp.date NOT IN (SELECT date FROM mytable WHERE mytable.date IN (list-of-input-attributes) and index = @index) The above query might return null result or a date . In case null return output as "DataNotMissing" In case not null return date and string as "Datamissing" Any help in this regard is highly appreciated. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-09-09 : 15:45:40
|
Here's an example:create table #temp (column1 int, column2 varchar(30), column3 bigint, column4 datetime)You haven't provided enough info for us to help you load the data into it. Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
Kanne
Starting Member
2 Posts |
Posted - 2014-09-09 : 17:55:17
|
Well I am new to creating stored proc in SQL server.The idea is to create this SP to accept 6 parameters as shown belowPopulate the temp table with these data and then run the below querySELECT date FROM #tempTableWHERE #temp.date NOT IN (SELECT date FROM mytable WHERE mytable.date IN (comma separated input attributes) and index = @index)Now return the following to the application In case null dataset return output as "DataNotMissing"In case not null dataset return date and string as "Datamissing"Appreciate an example structurequote: Originally posted by tkizer Here's an example:create table #temp (column1 int, column2 varchar(30), column3 bigint, column4 datetime)You haven't provided enough info for us to help you load the data into it. Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/
|
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-09-10 : 13:03:44
|
Populate the temp table with the values of the input parameters? That doesn't make any practical sense.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|