Click here to Skip to main content
15,890,512 members
Home / Discussions / Database
   

Database

 
GeneralRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
Mike Devenney14-Nov-08 10:01
Mike Devenney14-Nov-08 10:01 
GeneralRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
Wendelius14-Nov-08 10:12
mentorWendelius14-Nov-08 10:12 
AnswerRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
Alexandru Serban30-Dec-09 9:08
professionalAlexandru Serban30-Dec-09 9:08 
GeneralRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
RichardSouthworth14-Jan-10 2:02
RichardSouthworth14-Jan-10 2:02 
GeneralRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
Alexandru Serban14-Jan-10 5:03
professionalAlexandru Serban14-Jan-10 5:03 
GeneralRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
XavierSteel1-Feb-10 13:49
XavierSteel1-Feb-10 13:49 
GeneralRe: Creating a dynamic date parameter in a SQL Reporting Services subscription Pin
BStanneveld19-Jul-11 19:24
BStanneveld19-Jul-11 19:24 
QuestionCursor problem [solved/please ignore] Pin
leckey14-Nov-08 6:02
leckey14-Nov-08 6:02 
It's been a few years since I have done cursors and my head is starting to hurt due to changing user requirements. We are getting a file with three fields, SKU, pkg, and owner. I want to look up in the parts master table if there is a record where these three items match.

What I'm really getting confused is what to put in my logic to look at all three fields. First they just wanted to see if the sku existed. Okay, that was easy enough. But since this is really a composite key my brain just can not wrap itself around the solution. There are a few lines still in the code when I was dealing with only the SKU.

DECLARE partCursor CURSOR
FOR
	
	SELECT
		count(sku)
	FROM
		' + @svr + '.' + @dbname + '.dbo.pm_f 
	WHERE 
		sku IN (
				SELECT
					sku, pkg, owner
				FROM
					WMS_InboundOrder_D 
				WHERE 
					source_Id = ''' + @source_id + '''
				AND	application = ''' + @application + '''
				AND trans_type = ''' + @trans_type + '''
				)

OPEN partCursor
DECLARE @sku VARCHAR(20)
DECLARE @pkg VARCHAR(6)
DECLARE @owner VARCHAR(20)
DECLARE @partErrors VARCHAR(1000)
DECLARE @partFlag bit
SET @partErrors = ''''

FETCH NEXT FROM partCursor INTO @sku, @pkg, @owner
WHILE (@@FETCH_STATUS <> -1)
BEGIN
	IF (@@FETCH_STATUS <> -2)
	 WHAT TO PUT HERE????

		BEGIN
			SET @partErrors = @partErrors + '' SKU: '' + @sku + '' SKU does not exist in master part table! | ''
		END
	FETCH NEXT FROM partCursor INTO @sku, @pkg, @owner
END

SELECT CASE WHEN @partFlag = 0 THEN ''FALSE'' ELSE ''TRUE'' END as Result, @partErrors as Errors

CLOSE partCursor
DEALLOCATE partCursor


Blog link to be reinstated at a later date.

modified on Friday, November 14, 2008 12:48 PM

AnswerRe: Cursor problem Pin
Paddy Boyd14-Nov-08 6:08
Paddy Boyd14-Nov-08 6:08 
GeneralRe: Cursor problem Pin
leckey14-Nov-08 6:09
leckey14-Nov-08 6:09 
GeneralRe: Cursor problem Pin
Paddy Boyd14-Nov-08 6:11
Paddy Boyd14-Nov-08 6:11 
GeneralRe: Cursor problem Pin
leckey14-Nov-08 6:14
leckey14-Nov-08 6:14 
QuestionTwo Transactions in Stored Proc Pin
indian14314-Nov-08 5:16
indian14314-Nov-08 5:16 
AnswerRe: Two Transactions in Stored Proc Pin
dan!sh 14-Nov-08 5:28
professional dan!sh 14-Nov-08 5:28 
GeneralRe: Two Transactions in Stored Proc Pin
indian14314-Nov-08 5:45
indian14314-Nov-08 5:45 
GeneralRe: Two Transactions in Stored Proc Pin
dan!sh 14-Nov-08 7:22
professional dan!sh 14-Nov-08 7:22 
AnswerRe: Two Transactions in Stored Proc Pin
ToddHileHoffer14-Nov-08 5:31
ToddHileHoffer14-Nov-08 5:31 
GeneralRe: Two Transactions in Stored Proc Pin
indian14314-Nov-08 5:55
indian14314-Nov-08 5:55 
GeneralRe: Two Transactions in Stored Proc Pin
ToddHileHoffer14-Nov-08 5:57
ToddHileHoffer14-Nov-08 5:57 
QuestionIn sql service reports Pin
member2714-Nov-08 4:19
member2714-Nov-08 4:19 
AnswerRe: In sql service reports Pin
Paddy Boyd14-Nov-08 5:44
Paddy Boyd14-Nov-08 5:44 
GeneralRe: In sql service reports Pin
member2714-Nov-08 20:18
member2714-Nov-08 20:18 
QuestionStored Procedure Error Pin
Syed Shahid Hussain14-Nov-08 1:40
Syed Shahid Hussain14-Nov-08 1:40 
AnswerRe: Stored Procedure Error PinPopular
neilarnold14-Nov-08 2:00
neilarnold14-Nov-08 2:00 
GeneralRe: Stored Procedure Error Pin
Syed Shahid Hussain14-Nov-08 2:34
Syed Shahid Hussain14-Nov-08 2:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.