Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Between ?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00985297
Message ID:
00985387
Vues:
36
This message has been marked as the solution to the initial question of the thread.
Try this way
...
ldStartDate = DATE(lnYrFrom, lnMthFrom, 01)
ldEndDate = GOMONTH(DATE(lnYrTo, lnMthTo, 01),1)

TEXT TO lcCommand TEXTMERGE NOSHOW
SELECT * FROM rpt_details
	WHERE priority IN (?liService, ?liService2)
		AND inst_type IN (SELECT inst_no FROM rpt_instdet WHERE uid = ?liInstType)
		AND last_action_dt >= ?ldStartDate
		AND last_action_dt < ?ldEndDate
ENDTEXT
...
>Another question:
>Can I execute your suggested code from VFP using SQLEXEC() ?
>I tried the code belowe and it did not work.
>Thanks again for you help.
>
>
>PARAMETERS lcFrom, lcTo, liInstType, liService, liService2
>LOCAL lnMthFrom, lnYrFrom, lnMthTo, lnYrTo
>
>lnMthFrom = VAL(ALLTRIM(RIGHT(lcFrom, 2)))
>lnYrFrom = VAL(ALLTRIM(LEFT(lcFrom, 4)))
>lnMthTo = VAL(ALLTRIM(RIGHT(lcTo, 2)))
>lnYrTo = VAL(ALLTRIM(LEFT(lcTo, 4)))
>
>	
>	TEXT TO lcCommand TEXTMERGE NOSHOW
>		SELECT * FROM rpt_details
>			WHERE priority IN (?liService, ?liService2)
>			AND inst_type IN (SELECT inst_no FROM rpt_instdet WHERE uid = ?liInstType)
>			AND YEAR(last_action_dt) = ?nYrFrom AND MONTH(last_action_dt) = ?nMthFrom
>			AND last_action_dt >= CAST(?lnYrFrom*10000 + ?lnMthFrom*100 + 01 AS char(8))
>			AND last_action_dt < DATEADD(mm, 01, CAST(?lnYrTo*10000 + ?lnMthTo*100 + 01 AS char(8)))
>	ENDTEXT
>	
>	sqlResult = SQLEXEC(gSQLHandler, lcCommand, "TempCursor")
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform