execute

T-SQL EXEC versus sp_exec

醉酒当歌 提交于 2019-12-13 04:47:31
问题 I tried the following: declare @var2 nvarchar(30) declare @qsql nvarchar(100) set @var2 = N'iddelegat' exec ('select max('+ @var2 + ') as IDexec from delegat'); set @qsql = 'select max(@varsp) as IDspexec from delegat'; exec sp_executesql @qsql, N'@varsp nvarchar(30)', @var2; And the result: IDexec IDspexec ----------------------- 500038 iddelegat I could not understand why sp_executesql does not return the same result as EXECUTE . The right returned values are only in EXECUTE statement. It

stdout pymssql to variable

耗尽温柔 提交于 2019-12-13 02:16:48
问题 Im trying to retrieve the result form running import pymssql conn = pymssql.connect(server='IP', user='domain\user', password='PSWD', tds_version='8.0') cursor = conn.cursor() cursor.execute("EXEC msdb.dbo.sp_start_job @job_name = 'jobname'") when it add the job to the cue to process it wont return anything, but when the job wasn't runned it will return stuff like in a case for testing Traceback (most recent call last): File "shared/python3", line 85, in <module> cursor.execute("EXEC msdb.dbo

Cross platform recursive file list using C++?

筅森魡賤 提交于 2019-12-12 18:16:58
问题 What is the most efficient way to recursively list files in a specific directory and its subdirectories? Should I use the standard library, or use some third party? I want this because I use v8 as a JavaScript engine, and I want to execute all scripts in some directory (and its subdirectories). If there's any built-in way to do that in v8, great :) It should support Windows, Linux and OS X. Thanks. 回答1: For a generic cross-platform C++ solution, check out boost::filesystem 来源: https:/

will a false returned PDO execute() the same as the exception it thrown?

こ雲淡風輕ζ 提交于 2019-12-12 16:27:07
问题 As requested I reformat the question: For the following code: $newPDO=new PDO($DSN,$USER,$PASS); $newPDO->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $SQL='SOME SQL STATEMENT MAYBE FAULTY'; try{ $Query=$newPDO->Prepare($SQL) $Success=$Query->execute(); if(!$Success) echo('A'); } catch(PDOException $e) { echo('B'); } Question is, is it possible to see 'A' printed? Will the answer varies for different type of $SQL like select or insert? Original question: First I set the attribute

Why does my PDO statement -> execute return false?

你说的曾经没有我的故事 提交于 2019-12-12 16:05:17
问题 After near endless rounds of testing different aspects of this, I've determined that the PDO connection works (I can run a simple query and display results), I've determined that the statement is successfully preparing, and that the values are binding properly. For some reason, the statement won't execute. Just to be cute, I've tried removing all bound variables and executing a static query, and that won't work either. Code: $dbh = new PDO( "mysql:host=localhost;dbname=".$GLOBALS['data_name']

What is this cur.execute statement doing?

荒凉一梦 提交于 2019-12-12 03:52:29
问题 I am doing a Coursera course, working with Python and SQL databases. The code further below is largely example code from the course. I have to alter it for an assignment. The part which I do not completely understand is this part: cur.execute('SELECT count FROM Counts WHERE email = ? ', (email, )) row = cur.fetchone() if row is None: cur.execute('''INSERT INTO Counts (email, count) VALUES ( ?, 1 )''', ( email, ) ) else : cur.execute('UPDATE Counts SET count=count+1 WHERE email = ?', (email, )

How to get the result sets from tsql's execute?

蹲街弑〆低调 提交于 2019-12-12 01:54:58
问题 I try to remotely query table-valued function as it is offered in this SO answer. But I stumbled over how to get the returned result sets to further work with them in sql code... Calling UDF remotely is not supported by SQL Server and openquery cannot have parameters - only static string. declare @query nvarchar(max) = 'select * into #workingDays from openquery(LNKDSRV, ''select * from DB.dbo.fxn_getWorkingDays(''''' + cast(@date1 as nvarchar(max)) + ''''',''''' + cast(@date2 as nvarchar(max)

Running external program through python terminal

一世执手 提交于 2019-12-12 01:34:15
问题 i try to run a program( a stemmer with a tcl file) to read a txt file and save the result into an other txt file. When i run the command through dos-windows terminal it works fine, but when i run this through python terminal with os.system() it returns 1 value and nothing happens.. Here is the code: >>>import os >>>os.system('C:\Python27\Lib\site-packages\tclsh.exe -encoding utf-8 C:\Python27\Lib\site-packages\GreekStemmer.tcl in.txt out.txt') >>>1 I guess '1' means that the command didnt

SAS include dynamic path

江枫思渺然 提交于 2019-12-12 01:16:09
问题 I have tryed build little macro which in loop it should runother SAS programs. Table Control_files has two field, where are other part of path to proper sas program. %LET PATH_TO = '%include "T:\XXX\YYY\ZZZ\'; %LET PATH_end = '.sas"'; data _null_; set CONTROL_FILES; call execute ('%runlimitsquery('||&PATH_TO||SCHEMA_NAME||'\'||PROCES_NAME||&PATH_end||');'); run; I tryed used runlimitsquery because I found somewhere that tip.. When I run my code, log returns: NOTE: CALL EXECUTE generated line.

PDO MYSQL PHP prepare() and execute()

你离开我真会死。 提交于 2019-12-12 00:19:45
问题 its not linking up to the database. I've been trying to use prepare() and execute() to get it to post on the database but nothing shows up what am I doing wrong? <?php try { $dbh = new PDO('mysql:host=localhost;dbname=phpexample', 'root', ''); } catch (PDOException $e) { echo "Connection error: " . $e->getMessage(); } $query ="INSERT INTO products (id, sku, name) VALUES (:id, :sku, :title)"; $stmt = $dbh->prepare($query); $id = NULL; $sku = 'MN873213'; $title = 'Minty Mouthwash'; //binding