Most voted "sql-server" questions
SQL Server is a relational database management system from Microsoft. Use this tag for all SQL Server editions, including Compact, Express, Azure, Fasttrack and PDW.
Learn more…2,752 questions
Sort by count of
-
0
votes0
answers157
viewsHow to install sqlsrv driver on Pdo?
How do I install or sqlsrv driver on Pdo? <?php function conectar(){ $pdo = null; try { $opcoes = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $pdo = new…
-
0
votes2
answers3207
viewsCreating table with Primary key ID column with auto increment
I am using the SQL Server Management and I’m trying to create a table that has the ID which must be auto-incremented. However, I can’t use the property IDENTITY, and do everything in script, on the…
sql-serverasked 7 years, 8 months ago Bellon 83 -
0
votes1
answer669
viewsoccurrence of word in sql query
I have an appointment SELECT NOME FROM PESSOA WHERE CODIGO = 1 She returns to me ANA ANA JOAO ANA ALBERTO ANA There is a way to count the events of ana? Using only the sql query?…
-
0
votes1
answer252
viewsChanging a table
There is the possibility to change a table field without I lose the data that was previously entered? I have a table that has a field varchar and I need to change it to int. It already has entered…
sql-serverasked 7 years, 7 months ago Flavio Rodrigues 1 -
0
votes1
answer1200
viewsArgument 2 passed to sqlsrv_connect() must be of the type array, string Given
I searched many places and was amazed to find almost nothing of PHP OO using SQL Server. In short, I cannot understand what is wrong here, I think it helps, I thank you. <?php class Conexao{…
-
0
votes2
answers712
viewsMonitor performed SQL SERVER 2014 Insert/delete/update
Does anyone know how to register Insert/delete/update performed in the database outside the application or restricting by user? For example only via Sqlmanager only, The Database is SQL Server 2014;…
sql-serverasked 7 years, 7 months ago Guisal 3 -
0
votes0
answers42
viewsSynchronization of Data
Good afternoon guys. I have a small problem: I created a C# application for the management of a transport company. There they asked me to also create a web page from where the customer informing the…
-
0
votes1
answer345
viewsMy Sqlserver Express 2014 does not show all installation options
I formatted the PC and I’m trying to install the Sqlserver Express 2014 accompanying a tutorial on youtube, but when it comes to this point of the instation mine does not come all options equal to…
-
0
votes1
answer739
viewsLINQ Return from the list is with all the repeated records
I’m having problems performing a select (using LINQ) in a View in SQL Server 2012. The values stored in the bank are as below: ID_Acomp ID_Pessoa Nome Data 26 300 MONTEIRO 01-01-2016 27 300 MONTEIRO…
-
0
votes1
answer79
viewsQuery with datiff returning 0 in sql server result
I have the following appointment: SELECT DATEDIFF(hh, MIN(BATIDA), MAX(BATIDA))AS HORAS FROM ARELBATIDATRANSITOVIEW WHERE CHAPA = 3187 AND BATIDA IS NOT NULL AND SEQUENCIALBATIDA IN (2,3) GROUP BY…
-
0
votes1
answer63
viewsError in login system using SQL Server. Resource(7) of type (SQL Server Statement)
I am trying to make a login system between PHP and SQL Server and is giving the error Resource(7) of type (SQL Server Statement). index php. <form class="form-horizontal" id="FormLogin"…
-
0
votes1
answer40
viewsError trying to create a Proc in the bank
I’m trying to run a stored procedure in the bank and it’s giving this message: Cannot Grant, Deny, or revoke Permissions to sa, dbo, Entity Owner, information_schema, sys, or yourself How do I fix…
-
0
votes1
answer901
viewsBackup and Restore in Delphi with Sql Server how to do?
Hello I would like to know how I can do a Backup and Restore to integrate in my system. I have a code ready but is for Firebird I believe that does not fit to Sql Server. I read in some topics that…
-
0
votes2
answers4115
viewsQuery returning error in query between date period
Consultation: SELECT ROW_NUMBER() OVER(ORDER BY V.DATA ASC) AS ID, V.CHAPA AS CHAPA, F.NOME AS NOME, V.DATA AS DATA, CASE WHEN V.BATIDA IS NULL THEN 0 ELSE V.BATIDA END AS FOLGA FROM…
-
0
votes1
answer1553
viewsPopular table in sql server with data coming from an excel spreadsheet
How I create a script or via DTS, a popular form of a table in the sql server 2014, with information from a spreadsheet of excel? The worksheet has several columns, but only two columns will be…
-
0
votes2
answers950
viewsCalculate Value of SQL columns
I have two tables BMV_PEDIDO and BMV_PEDIDOITEM and would like the total sum of the value of the orders made on a given date. I currently make this request per request, ie, I replicate this code…
-
0
votes2
answers209
viewsRelated tables: What is it? What is it? What is it for? What justifies its use?
I would like a better explanation of this strategy (if so called) and what justifies its use since I see some commercial systems using it. Supplementation of the question: Well, I had never seen it…
-
0
votes2
answers364
viewssql inserts the wrong datetime into the table
i to using microsoft sql manager,and was trying to insert a date in my table,the problem is that it is entering the wrong date,i do the following command for the manager table INSERT INTO tblCliente…
-
0
votes1
answer167
viewsQuery condition to display only records that contain the same 3x consecutive number
I have the following appointment: with Consulta as ( SELECT V.CHAPA, F.NOME, V.DATA, F.FILIAL, DATENAME(dw,V.DATA) AS DIA, MAX(V.SEQUENCIALBATIDA) AS BATIDA FROM V_BATIDASANTIGAS AS V LEFT JOIN…
sql-serverasked 8 years, 1 month ago Chefe Druida 1,086 -
0
votes2
answers753
viewsUNION with 2 DATABASES, SQL
I need to integrate 2 TABLES from DBdifferent in one DGV. I found several tutorials, but none that helped me from setting up to the connection, at least not the way I work with the connections.…
-
0
votes1
answer264
viewsHow to run a c# program on the client machine?
Good afternoon guys, I just finished a sales system in c#,I am testing the same on another machine this generate error, I have installed . Net Framework 4.5 but still continues. What will be the…
-
0
votes1
answer85
viewsValidation php Pdo function
I have the function below that makes an Insert in table ESP35302_TMP but before inserting I need to do a validation in this table, if there is already the number of barcode I am inserting, if there…
-
0
votes1
answer3342
viewsGenerate database script with structure and data
Backup is not possible to do, because it depends on permission from France and etc. So, the solution we found here was to try to generate a script that copies not only the structure of the tables, I…
-
0
votes1
answer1193
viewsWarning: sqlsrv_fetch_array() expects Parameter 1 to be Resource, Boolean Given in D: xampp5.6 htdocs sysriomed bank-material.php on line 27
I am making a form for editing materials (products). I am viewing the list of materials and I created in my form a button that passes my IdItem. I’m in error: Warning: sqlsrv_fetch_array() expects…
-
0
votes2
answers1212
viewsFigure out which column would be truncated (date would be truncated)
good evening! When trying to enter a record in Sqlserver through my application I am getting a truncated data message. The problem is that there are many columns that this screen fills and I have no…
-
0
votes1
answer911
viewsPDO SQLSTATE[07002]:COUNT field incorrect or syntax error
I’m having trouble making a decrease in sql with Pdo. I’m getting the following error SQLSTATE[07002]: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error code <?php…
-
0
votes1
answer77
viewsAzure SQL connection failure
I am receiving the error message below when trying to connect to a database hosted in AZURE through a WEB application: An Exception has been raiset that is likely due to Transient Failure. If you…
-
0
votes1
answer43
viewsStatement of 2 PK Sql
Good afternoon. I have the table Icms that has as PK the columnIcmClaFiscal, need to pass the column IcmEmpresa also as PK, but SQL gives me an alert. As I have been able to do this procedure in…
-
0
votes0
answers275
viewsCode Igniter - How to call a precedent that is in another database?
I have an SQL Server where we have several Databases and their schemas. So far so good, but I need access to a stored database. I tried it :…
-
0
votes2
answers2053
viewsSearch Records that are not in another table
Good morning.. I have the table [BCT_PESSOA] with PK [ID_PESSOA] this table has relationship with the table [BCS_USUARIO] with the column [ID_PESSOA] I would like to return all records to the table…
-
0
votes0
answers41
viewsDataset query showing last created ID giving error
I’m making a people registration form which when I finish entering the data it shows a MessageBox telling which ID the person was registered with. For that I use a query of my dataset(I’m using…
-
0
votes0
answers94
viewsSQL - AVG with vendor alias and grouping
I need to create a query that calculates the average of a vendor delivery "score". It follows query, and in sequence, explanation of the fields: SELECT distinct C7_FILIAL, CASE WHEN C7_FILIAL =…
-
0
votes2
answers183
viewsSelect in Sql Server
Good morning. I have a table with columns Version, Updated, LastChanged. I want to make a query to select the highest version value, with the respective LastChanged, corresponding to Updated = 1; I…
-
0
votes1
answer69
viewsHow to make a remote Sql server configuration?
Good afternoon guys, I need to develop a C# system that needs to use the same database on three different computers, so I need to allow my SQL Server 2008 R2 to allow remote connection to the…
sql-serverasked 7 years, 6 months ago António Mateta 159 -
0
votes2
answers150
viewsIs it possible to apply to different computers simultaneously performing CRUD?
I am creating an application in C# using Visualstudio 2015 Enterprise together with SQL Server 2016 to save the data, but I’m almost done with the project and I still don’t know if it will actually…
-
0
votes1
answer160
viewsProblems with encoding SQL Server 2008
I am performing a query in an Sql Server database, but the special characters are returned as follows: MAR�O instead of MARÇO I was able to fix using the function utf8_encode(), but I do not want to…
-
0
votes2
answers314
viewsHow to restore a database backup from a c#application?
I have searched how to restore a backup of BD through a c#application, but I had difficulty understanding the logic. I have already programmed a form that performs the backup and have no idea how a…
-
0
votes1
answer134
viewsSQL Server 2012 - SQL Server authentication login
At the installation I put a password and wrote it down. When I am going to log in for SQL server authentication the login field is empty, I just wrote down the password I don’t know the login. I…
-
0
votes1
answer418
viewsCount the amount of my IF records
IF(Count(UCID)>1,Count(UCID),'0'), it brings me approximately 500 lines of record, being numbers of 2 above, I want to be able to make a COUNT in that IF to present those 500 in a column to part.…
-
0
votes1
answer51
viewsSql server 2008 connection
Good night I installed Microsoft Sql Server Management Studio 2008 on my machine to do local tests, but I cannot access it. Even if it’s free, how do I instantiate access, I have to reinstall the…
sql-serverasked 7 years, 5 months ago Igor Carreiro 1,917 -
0
votes1
answer415
viewsHow to return only the ref. data to the logged in user
I have a table that returns the following data from an SQL Server database: INITIAL KM; KM Final; Liters; R-value$. However I would like to return only the values ref. to the logged in user. In the…
-
0
votes3
answers193
viewsSelect only first place in the first half - SQL Server Code
I made this code for SQL Server to select how many times the driver "Asdovolante" came first in the first half of 2017. But it doesn’t work. What may be wrong? SELECT P.Data, Nm.Nome,…
-
0
votes1
answer810
viewsCheck the triggers linked to a given table
I use the database Sql Server 2012 And the tool SQL Server Management Studio 2012 How can I check the triggers which are linked to certain tables without having to go by the object explorer? there…
-
0
votes1
answer688
viewsUse DISTINCT SQL Server clause
Hi, I need some help ! I need to do a query and bring in the Nifs without repeating. I do it like this: SELECT DISTINCT NIF FROM CustomerRegistrations But I also want to bring more columns from this…
-
0
votes0
answers386
viewsCreate a PHP query to insert into the table
Hello, how can I create a php query that click the button insert the codes in the table? My code: <?php $error = null; $sucses = null; if(isset($_POST['Promo'])) { $AwardID = $_POST['AwardID'];…
-
0
votes0
answers144
viewsError 500 php SQL Server
I tried to make a code in PHP and I’m having difficulties with the query of SQL Server, now I tried to make a query another way and gave error 500 in PHP what can be? Code of my page: <?php…
-
0
votes1
answer2401
viewsHow to convert a varchar type from a column to datetime within a view using SQL?
I have a view with a varchar type column and I want to convert this column to a date time type my code is here: update temp_vertical_dashboard set data = convert (datetime,data,101)…
-
0
votes1
answer65
viewsQuery with SQL Server query
I have the following query in SQL Server, to return me a list of cities I need. select IDCidade as "ID", case UF when 'RS' then '1' when 'SC' then '2' when 'PR' then '3' when 'SP' then '4' when 'RJ'…
sql database sql-server query sql-server-2012asked 7 years, 11 months ago Luís Felipe Dal Molin 169 -
0
votes1
answer632
viewsSQL to check skipped number
I have a table with 12,560 records from 5 years ago, that is, it does not have such a good modeling and it has a field called 'code' that the user filled with something like CA-0001. The problem is…
-
0
votes1
answer106
viewsPull the last information from a table
I wanted to know how to pull the last information that was registered in the bank, but I can’t use the ID. in my Route table have the columns Id(PK), Date, Current Km_and Nveiculoid(CK). In this…