w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Issue in cakephp when execute certain MSSQL stored procedure
I think your problem may have to do with multiple recordsets and how the driver handles sending them (or how it may potentially handle it.) Could you try to change one of your stored proc's to this ALTER PROCEDURE [dbo].[GetColumns_Information] @GroupOverride midsys_boolean AS IF ( @GroupOverride = 1 ) BEGIN SELECT columns_id, columns_columntypesid, columns_columnname, columns_usercolumnname, 1 AS 'columns_columnsettings' FROM ColumnsTable ORDER BY columns_id END ELSE BEGIN SELECT columns_id, columns_columntypesid, columns_columnname, columns_usercolumnname, columns_columnsettings FROM ColumnsTable ORDER BY columns_id END In this case, you could simplify to one recordset SELECT columns_id, columns_columntypesid, columns_columnname, columns_usercolumnname, CASE WHE

Categories : PHP

How to insert PHP array values using an stored procedure SQL SERVER 2008 R2(mssql)
$sql = "INSERT INTO table column(c1,c2) VALUES('d1','d2'),('dd1','dd2'),('ddd1','ddd2')";// this is the basic sql command $data = array('data1','data2','data3'); $data = '('.implode(', ',$data).')'; $sql = "INSERT INTO table column(c1,c2) VALUES $data"; $data = array(array('1','2','3'),array('4','5','6'),array('7','8','9')); $xa = array(); $a = 0; foreach($data as $dt) { $xa[$a] = '('.implode(',',$dt).')'; ++$a; } $data = '('.implode(',',$xa).')'; $sql = "INSERT INTO table column(c1,c2) VALUES $data";

Categories : PHP

how to execute sql server stored procedure on php?
read this articles <?php $conn = mssql_connect($host, $user, $pass); mssql_select_db('somedb', $conn); // Call a simple query $result = mssql_query('SELECT * FROM sometable', $conn); // Release the result resource mssql_free_result($result); // Then execute the procedure $proc = mssql_init('some_proc', $conn); $proc_result = mssql_execute($proc); // Etc... mssql_free_statement($proc); ?> the see this also $conn = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password); $exec = odbc_exec($conn, "CALL storedProc()"); read these one;;two;;

Categories : PHP

How to define call of stored procedure in hibernate mapping file and then call it from java (mssql server)
There are few examples for you here but here is how you would call a stored procedure using entity // This stored procedure returns a result set and has one input parameter. @NamedStoredProcedureQuery( name = "ReadAddressById", resultClasses = Address.class, procedureName = "READ_ADDRESS", parameters = { @StoredProcedureParameter(mode=IN, name="P_ADDRESS_ID", type=Long.class) } ) @Entity public class Address { ... }

Categories : Java

SQL Server - Execute Stored Procedure Only Role
create a role and make it member of db_datareader then add EXECUTE permission to each procedure individually. Example with an user called test and member of that role. Run this as an admin: CREATE TABLE test (id INT) GO CREATE PROCEDURE INSERTtest AS begin INSERT INTO dbo.test (id) VALUES (1) END GO GRANT EXECUTE ON dbo.INSERTtest TO test GO If your procs inset data into the tables, and they don't break the object's ownership chain, you should be fine with this set up. Try this with the user: SELECT * FROM dbo.test --sucess INSERT INTO dbo.test(id)VALUES(1) -- fail EXEC INSERTtest --sucess

Categories : Sql Server

Execute a SQL Server stored procedure with different input parameter on a thread via C#?
Since the problem is locking tables, to execute SP's in parallel you will need to change the Isolation level in your SPs. One way to do this is like this: ..... FROM dbo.TableName with (nolock) ..... Note, that this can lead to unexpected behavior, but I think that as long as no 2 parallel queries modify the same rows it should be good. Please read this thread to learn more about the method When to use with (nolock)

Categories : C#

How to use SQL Server Management studio - "Execute Stored Procedure" for User Defined Table Types?
You need to declare table variable, insert data into it if needed, call your stored procedure not using @parameter = 1 format: DECLARE @return_value int, @tblParameter tblType_XXX INSERT INTO @tblParameter VALUES (1) EXEC @return_value = [dbo].[uspGetXXXXXXXX] @tblParameter

Categories : SQL

PHP - MSSQL getting results from Stored Procedures
This is some code that I have in one of my applications. See if it helps: //Query SQL $tsql = "Exec spinsert @tabla=?,@columnas=?,@valores=?"; $params = array($tabla,$columnas,$valores); //Execute the stored query $stmt = sqlsrv_query($conn, $tsql, $params); if ($stmt === false) { echo "<h3>Error in query preparation or execution.</h3>"; ListErrors(); die; } else { echo "Insert Successful"; } // this should help for the non-insert/update case $arr = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); var_dump($arr);

Categories : PHP

Execute SQL arithmetic stored as string (stored procedure? c#?)
I would create a function to return quantity based on the business logic related to misc fields. Example function would be create dbo.fn_GetQuantity(@Qty int, @width decimal(18, 3), @Height decimal(18,3)) returns int as begin -- TODO Apply all business logic related to @width & @height here and calculate new @Qty return @Qty end then in the proc I would just call this new function with needed parameters. create proc dbo.sGetParts() as begin select Part, dbo.fn_GetQuantity(Qty, finWidth, finWidth) from parts end

Categories : C#

mssql unable to execute multiple ID's in one short
It's hard to tell from your question, but one potential issue is the size of you IN statement. You would be better off builidng a temp table and populating it with the list of values and then using that temp temp in a JOIN.

Categories : PHP

How to call a stored procedure from MSSQL into grails
You can look in the Groovy Documentation about "Stored Procedure Support". Example: sql.call '{call Hemisphere(?, ?, ?)}', ['Guillaume', 'Laforge', Sql.VARCHAR], { dwells -> println dwells // => Northern Hemisphere }

Categories : Sql Server

MSSQL trigger will not work with stored procedure
your trigger will be executing as caller by default,which I am guessing does not have permission to use your addticket procedure. try adding execute as user_name where user_name has permission to use that proc

Categories : Sql Server

How can I call MSSQL encrypted Stored Procedures from Java?
How can I get list of these encrypted Stored Procedures? SELECT SCHEMA_NAME(p.schema_id) + '.' + p.name FROM sys.procedures p WHERE OBJECTPROPERTY(p.object_id, 'IsEncrypted') = 1 How can I invoke MSSQL encrypted Stored Procedures from Java? Should be no difference between encrypted and non-encrypted stored procedures when you invoke their from Java.

Categories : Java

How to change schema of all tables, views and stored procedures in MSSQL
Yes, it is possible. To change the schema of a database object you need to run the following SQL script: ALTER SCHEMA NewSchemaName TRANSFER OldSchemaName.ObjectName Where ObjectName can be the name of a table, a view or a stored procedure. The problem seems to be getting the list of all database objects with a given shcema name. Thankfully, there is a system table named sys.Objects that stores all database objects. The following query will generate all needed SQL scripts to complete this task: SELECT 'ALTER SCHEMA NewSchemaName TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];' FROM sys.Objects DbObjects INNER JOIN sys.Schemas SysSchemas ON DbObjects.schema_id = SysSchemas.schema_id WHERE SysSchemas.Name = 'OldSchemaName' AND (DbObjects.Type IN ('U', 'P', 'V')) Where typ

Categories : SQL

Rails - "Filter chain halted as :authorize rendered or redirected" when I execute extended function
I've solved the question. As I noticed, the problem was with the permission to execute the function. I just added the permission (see the code below) in the init.rb that gave me access to execute the function. permission :repositories, :repositories => :exec_client The other permission listed above (see in init.rb code) is another thing not directly linked to the permission to execute the function. That little detail gave me in a big trouble. I hope this can be useful to someone. Any question about the answer, please argue! ;) Thanks!

Categories : Ruby On Rails

sqlsrv error while connecting to mssql server 2008 on windows 2003 server
Two ways to try, first to check if the Native driver has the right version - is your server really a 32bit Version and not 84bit? The other thing is, to check if the extensions are actually loaded. To check that, create a file like "phpinfo.php" and put it in you folder for .htdocs. <?php // show phpinfo file phpinfo(); ?> The easy way is to search for it in the phpinfo-Page with Ctrl+F and "extension=php_sqlsrv_53_ts_vc9.dll"

Categories : PHP

PHP support for Mssql on windows server
php do support almost all database including mssql. All you need to do is to just enable it by removing the semicolon from php.ini Regards Alok sportsafter

Categories : PHP

mysql communicate with mssql on different server via php
Well, you can use the mssql select querys, set a variable in php with the result from the mssql query, and then do a mysql insert query to insert it into your database $link = mssql_connect($server, 'sa', 'phpfi'); mssql_select_db('php', $link) $query = mssql_query('SELECT [id] FROM [php].[dbo].[userlist]'); while ($row = mssql_fetch_assoc($query)) { $row['id'] $con=mysqli_connect("127.0.0.1","root","pass","db"); mysqli_query($con,"INSERT INTO tablname VALUES('$id')"); } Give this a try. Of course you have to customize it to fit your needs.

Categories : PHP

Connect to MSSQL Server with a Heroku PHP App?
Heroku by default support Postgres data server for free versions. Other DB connectivity can be made available via add on(paid at the time of posting this as an answer). Following are the data stores, available to you this time - Now your case - mssql, I dont think Heroku this time providing any data store for this database, so either you need to find some s/w that can manage the data migration from one db to another without any flaws. It is always recommended to refer to the support channel for these kind of things(as things keep changing too frequently in cloud).

Categories : PHP

How to get the MAC-address from MSSQL server 2000
According to this, it doesn't seem you can. If you were using SQL Server 2005+, I'd think you could code up something in SQLCLR to do this without too much effort.

Categories : Sql Server

Connect to MSSQL Server 2008 on linux
Do you have all the software you need? This is what you need for Ubuntu 12.04: sudo apt-get install php5-odbc php5-sybase tdsodbc Have you configured your these files on your Linux server? (These are taken from an Ubuntu 12.04 server) /etc/odbc.ini # Define a connection to the MSSQL server. # The Description can be whatever we want it to be. # The Driver value must match what we have defined in /etc/odbcinst.ini # The Database name must be the name of the database this connection will connect to. # The ServerName is the name we defined in /etc/freetds/freetds.conf # The TDS_Version should match what we defined in /etc/freetds/freetds.conf [mssql] Description = MSSQL Server Driver = freetds Database = MyDatabase ServerName = mssq

Categories : Python

Script MSSQL query on remote server
You need to have SQL Client in the machine where you will be running this query. You can run the SQLCMD command below to run the query and save output to file. sqlcmd -S(servername) -E -i(sql file) -o(output filename) -d(databasename) -s, -E option is for trusted connection Hope this helps.

Categories : Sql Server

Insert to remote server MSSQL 2005
in your case the update statement opens a local transaction and the insert statement also opens a transaction with the remote server which will be the case for the distributed transaction. In order to make this work, you have to start the DTC http://support.microsoft.com/kb/817064 To know more about distributed transactions, you can check the link http://msdn.microsoft.com/en-us/library/windows/desktop/ms681205%28v=vs.85%29.aspx

Categories : SQL

Data transfer From access to MSSQL server
You can use Data Import from SSMS. Right click on DB select Tasks Import data.. Select your Access DB as source Set the mappings etc from your source to destination You can save this as an SSIS package to either re-run at a later date or to develop in BIDS for a more advanced import toolset.

Categories : Sql Server

UNIX timestamp on MySQL and MSSQL Server
You can try this link for understanding timestamp in Mysql http://www.mysqltutorial.org/mysql-timestamp.aspx for tsql timestamp you can check out these links http://www.informit.com/library/content.aspx?b=STY_Sql_Server_7&seqNum=97 http://technet.microsoft.com/en-us/library/ms188751(v=sql.110).aspx

Categories : Mysql

Is there a good MSSQL / SQL Server adapter for sails.js?
Technically since Sails is base on express.js you could use custom express middleware to specify the use of your an adapter that has already been created. The first one is the top rated adapter checkout https://nodejsmodules.org/tags/mysql Otherwise you can just use the waterline ORM and the MySQL adapter that is provided for sails.js https://github.com/balderdashy/sails-mysql For documentation on how to use waterline models checkout the 0.9x docuemntation http://sailsjs.org/#!documentation/models

Categories : Javascript

execute stored procedure with pdo
My first glaring question is why are you passing a $data array into the execute() when your updateLosingSelections() has no parameters? Essentially: //turn this $sth->execute($data); //into this $sth->execute(); //or if you want to do this $sth->execute($data); //then make sure to do this session_start(); include_once('../connections/connection.php'); $sql_update_standings = 'call updateLosingSelections(?,?)'; //two question marks as placement holders $sth = $dbh->prepare($sql_update_standings); $sth->execute($data('somedata','moredata')); //two pieces of data which will replace the two ? marks above I recommend taking a look at the DB2 documentation, seems quite similar. http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.swg.im.dbclient.php.doc

Categories : PHP

Unable to connect to MSSQL server on Amazon RDS using NAT instance
Your problem is a little bigger than security group changes. The main problem is that your private vpc is private as in 'not internet accessible'. You have several options to connect from outside: Use a bastion machine as an intermediate hop (on the public net) and add relevant SG rules to hop form that machine into your precious DB. Your users will need to connect to that machine and then either run client tools on that machine to connect to the DB or setup a SSH tunnel to your DB (so your office machine could connect). This is not a great solution in term of users experience and in term of security (the bastion become a very big security risk) but it is simple to setup. (Note: since you are MS dude then please switch SSH for RDP [and cancel the tunneling thing]) Setup a VPN - bring a

Categories : Database

How to execute a stored procedure after it is created?
You need a GO after you created the SP otherwise you have created a recursive SP that calls itself "indefinitely" which is 32 times in SQL Server. Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32). Try this: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE sp_Transfer_RegionData AS BEGIN INSERT INTO Region (regionName) SELECT column1 FROM openquery(ITDB, 'select * from db.table1') END GO EXEC sp_Transfer_RegionData

Categories : SQL

How to execute the php script that stored in database
eval() will do what you want. eval($string); I really wouldn't suggest storing php in your database though as there are normally much more predictable, readable, understandable and maintainable ways of handling issues where you dynamically run different code based on results.

Categories : PHP

Lua - Execute a Function Stored in a Table
It's not really clear what you're trying to do. Inside your anonymous function, you're returning a table that uses on_scene's return value as keys. But your on_scene doesn't return anything. Same thing for talk. I'm going to assume that you wanted on_scene and talk to get called when invoking each levels in your game_level_hints table. If so, this is how you can do it: local maxlevel = 99 for i = 0, maxlevel do game_level_hints.levels["level" .. i] = function() on_scene("scene" .. i) talk("hint" .. i) end end -- ... for levelname, levelfunc in pairs(game_level_hints.levels) do levelfunc() end

Categories : Function

Why does query execute on its own but not in a stored procedure
The error message indicates you have a differing number of columns in HistoricalLandingDetails to the results returned by your select query which has all the data from HistoricalLandingDetails and LandingHeaders. I would recommend specifying columns in the insert and in the select to make sure everything matches up e.g. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [HistoricalData].[TransferAllLandingInformation] -- Add the parameters for the stored procedure here @cutoffdate date AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here INSERT INTO HistoricalData.HistoricalLandingDetails (cola, colb, colc) SELECT ld.cola,

Categories : SQL

Need help to execute sql scripts within stored procedure
Misread the question originally. try using declare @sopScript varchar(1000) select sopScript into #ControlTbl from M_SopInsert where soptype = @soptype and sopnumbe = @sopnumbe and lnitmseq = @lnitmseq while exists (select * from #ControlTbl) begin select top 1 @sopScript = sopScript from #ControlTbl begin try exec executesql @sopScript = sopScript end try begin catch *do something* end catch delete from #ControlTbl where sopScript = @sopScript end

Categories : Sql Server

how to execute on a dataset stored as a string in R
Functions like ls and rm have a list argument that lets you specify the names of objects as strings. So in this case, you want rm(list=metadata$dfname).

Categories : R

How to execute SQL query stored in variable in PHP
You need a link: $link = mysqli_connect(DB_SERVER, DB_USER, DB_PASS,DB_NAME); Then: $result = mysqli_query($link, $query) What is in your $success var? If it is the link, then are you checking: if (mysqli_connect_errno()) { return false; // or whatever other flag that it failed }

Categories : PHP

execute queries that aren't stored on DB
I believe you could open the file read it in and then execute an SQL command created from the file string and then execute the command. I am not sure if there is a better way but that's how I would do it.

Categories : C#

Can i safely delete MSSQL Server 2008 R2 after installing 2012?
When I upgraded to SQL 2012, I first removed SQL 2008 completely in Programs and features and then installed SQL 2012. This was fine and I had no problems. Where ever practically possible I would recommend removing the old product first before installing the new. I would think that removing SQL 2008 should be fine. Worst case senario you may have to do a repair on SQL 2012 or re-install.

Categories : Sql Server

Do I need to configure anything in MSSQL Server Management Studio to use the SQLSRV driver in PHP?
The MSSQL Server Management Studio has nothing to do with the connection PHP makes using an extension to the server. If you have a successful connection from PHP to the server, then there should be no issue when you try calling your PHP script from a browser (unless your web server is not configured correctly).

Categories : PHP

msSQL jdbc .. I connected to the server but how to connect to use a specific databaseName
Use below connection string: c = DriverManager.getConnection("jdbc:sqlserver://SERVERNAME:PORTNO;databaseName=DATABASENAME; user=MyUserName;password=*****"); OR c = DriverManager.getConnection("jdbc:sqlserver://SERVERNAME:PORTNO;databaseName=DATABASENAME", MyUserName, MyPassword);

Categories : Java

Is it possible convert file .sql (I use MSSQL SERVER 2008 R2) to .bacpac with C# code?
Maybe... but you can just export your database as a Data Tier Application which should create a .bacpac file, or you can use the SQL Azure Migration Wizard to help you move your application.

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.