[RESOLVIDO]Retorno de um SP

B oa tarde, estou com uma duvida simples, tenho um Stored Procedure no banco que faz uma srie de checagens e retorna a mensagem de erro, se tiver algum. Como faço para receber essa mensagem no SC? tentei com a macro sc_exec_sql, porém sem sucesso, tem algum modo manual de faze-lo?

sc_lookup oi sc_select

De um var_dump na variável result set que você.passa como parâmetro para.macro.

1 Curtida

Estou rodando o comando a baixo:
image

No banco esse comando me retorna um “OK”:
image

No Var_Dump mostra de tudo, menos o “OK”:

Nenhuma dessas variáveis de retorno atende ?

1 Curtida

Pior que não, precisava de um retorno “OK” em uma variavel “Return”, mas n encontrei

object(ADORecordset_mssqlnative)#7 (29) { ["dataProvider"]=> string(6) "native" ["fields"]=> bool(false) ["blobSize"]=> int(100) ["canSeek"]=> bool(false) ["sql"]=> string(28) "SP_SiloCorrigeProduto 42,1,5" ["EOF"]=> bool(true) ["emptyTimeStamp"]=> string(6) " " ["emptyDate"]=> string(6) " " ["debug"]=> bool(false) ["timeCreated"]=> int(0) ["bind"]=> bool(false) ["fetchMode"]=> int(0) ["connection"]=> object(ADODB_mssqlnative)#13 (82) { ["dataProvider"]=> string(11) "mssqlnative" ["databaseType"]=> string(11) "mssqlnative" ["database"]=> string(28) "SigaFran_v546" ["host"]=> string(11) "server,1433" ["user"]=> string(8) "" ["password"]=> string(18) "" ["debug"]=> bool(false) ["maxblobsize"]=> int(262144) ["concat_operator"]=> string(1) "+" ["substr"]=> string(9) "substring" ["length"]=> string(3) "len" ["random"]=> string(6) "rand()" ["upperCase"]=> string(5) "upper" ["fmtDate"]=> string(7) "'Y-m-d'" ["fmtTimeStamp"]=> string(13) "'Y-m-d H:i:s'" ["true"]=> string(1) "1" ["false"]=> string(1) "0" ["replaceQuote"]=> string(2) "''" ["nameQuote"]=> string(1) """ ["charSet"]=> bool(false) ["metaDatabasesSQL"]=> string(56) "select name from sys.sysdatabases where name <> 'master'" ["metaTablesSQL"]=> string(742) "select name,case when type='U' then 'T' else 'V' end from sysobjects where (type='U' or type='V') and (name not in ('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE','dtproperties'))" ["uniqueOrderBy"]=> bool(true) ["emptyDate"]=> string(6) " " ["emptyTimeStamp"]=> string(6) " " ["lastInsID"]=> bool(false) ["hasInsertID"]=> bool(true) ["hasAffectedRows"]=> bool(true) ["hasTop"]=> string(3) "top" ["hasLimit"]=> bool(false) ["readOnly"]=> bool(false) ["hasMoveFirst"]=> bool(false) ["hasGenID"]=> bool(true) ["hasTransactions"]=> bool(true) ["genID"]=> int(0) ["raiseErrorFn"]=> bool(false) ["isoDates"]=> bool(false) ["cacheSecs"]=> int(3600) ["memCache"]=> bool(false) ["memCacheHost"]=> NULL ["memCachePort"]=> int(11211) ["memCacheCompress"]=> bool(false) ["sysDate"]=> string(49) "convert(datetime,convert(char,GetDate(),102),102)" ["sysTimeStamp"]=> string(9) "GetDate()" ["arrayClass"]=> string(30) "ADORecordSet_array_mssqlnative" ["noNullStrings"]=> bool(false) ["numCacheHits"]=> int(0) ["numCacheMisses"]=> int(0) ["pageExecuteCountRows"]=> bool(true) ["uniqueSort"]=> bool(true) ["leftOuter"]=> string(2) "*=" ["rightOuter"]=> string(2) "=*" ["ansiOuter"]=> bool(true) ["autoRollback"]=> bool(false) ["poorAffectedRows"]=> bool(false) ["fnExecute"]=> bool(false) ["fnCacheExecute"]=> bool(false) ["blobEncodeType"]=> bool(false) ["rsPrefix"]=> string(13) "ADORecordSet_" ["autoCommit"]=> bool(true) ["transOff"]=> int(0) ["transCnt"]=> int(0) ["fetchMode"]=> bool(false) ["null2null"]=> string(4) "null" ["_oldRaiseFn"]=> bool(false) ["_transOK"]=> NULL ["_connectionID"]=> resource(44) of type (SQL Server Connection) ["_errorMsg"]=> bool(false) ["_errorCode"]=> bool(false) ["_queryID"]=> resource(59) of type (SQL Server Statement) ["_isPersistentConnection"]=> bool(false) ["_bindInputArray"]=> bool(true) ["_evalAll"]=> bool(false) ["_affected"]=> bool(false) ["_logsql"]=> bool(false) ["_transmode"]=> string(0) "" ["bol_sc_debug"]=> bool(false) ["bol_sc_debug_level"]=> int(0) ["metaColumnsSQL"]=> string(301) "select c.name as name,t.name as type, c.length, (case when c.xusertype=61 then 0 else c.xprec end) as length2, (case when c.xusertype=61 then 0 else c.xscale end) as xscale from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'" ["maxParameterLen"]=> int(4000) ["identitySQL"]=> string(23) "select SCOPE_IDENTITY()" ["_dropSeqSQL"]=> string(13) "drop table %s" } ["_numOfRows"]=> int(0) ["_numOfFields"]=> int(-1) ["_queryID"]=> resource(59) of type (SQL Server Statement) ["_currentRow"]=> int(0) ["_closed"]=> bool(false) ["_inited"]=> bool(true) ["_obj"]=> NULL ["_names"]=> NULL ["_currentPage"]=> int(-1) ["_atFirstPage"]=> bool(false) ["_atLastPage"]=> bool(false) ["_lastPageNo"]=> int(-1) ["_maxRecordCount"]=> int(0) ["datetime"]=> bool(false) ["databaseType"]=> string(11) "mssqlnative" ["fieldOffset"]=> int(0) }

Se rodar a stored procedure direto no banco o que ela mostra?

1 Curtida

Se eu rodar o mesmo comando, com os mesmo parametros, ele retorna “OK”, como no print da resposta acima

sc_lookup(ds, $sql);
If ($ds[0][0]==‘ok’) …

Tentativa…

1 Curtida

Bom dia.
Tenho .recurso com biblioteca externa que pode resolver, caso não tenha conseguido capturar o resultado com sc_lookup.

1 Curtida

Bom dia, realmente, não tive sucesso. Tentei como falou acima, mas sem sucesso.

Consegui ajustar, alterei no banco para retornar em uma coluna, ai deu certo o lookup:

Muito obrigado @InfinitusWeb pelo auxilio

2 Curtidas