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
votes1
answer49
viewsI can’t give a Grant in a schema
I am working with an SQL Server 2012 database and I am trying to assign a Grant to a schema with the following command: GRANT INSERT ON SCHEMA :: trunk TO trunk And I’m having the following mistake:…
-
0
votes2
answers1544
viewsExport SQL Server 2014 Database
I need to export the SQL Server database to send to a friend. However I am not getting, I wonder if I copy these files and send to it, if it will work in his SQL Server (I do not know what version…
-
0
votes1
answer126
viewsSort by position of edited record (sql server)
When I enter a new record, I make an ordination where I sort by the last entered record. SELECT TOP(50) * FROM TB_CLIENTE_FORNECEDOR where status <> 'S' order by IDCLIENTEFORNECEDOR desc If I…
-
0
votes1
answer371
viewsI can run any query on SQL Server without passing credentials, is that normal?
I was looking to restart the SQL Server service, that’s when I discovered a way to manipulate the database without logging into the system. See: I opened Management Studio. I canceled the…
-
0
votes3
answers2086
viewsReturn an sql command in a Function
I wonder if it is possible to return an sql command in a Function to run as a subselect. For example: Select *, produtos = (nome_da_function()) from Usuario Because the way I did I could only return…
-
0
votes1
answer2210
viewsOrder by with Union
I have the following tables: Pessoa1 Id | Nome | Cidade 1 | José |São Paulo 2 | Maria |Rio de Janeiro Pessoa2 Id | Nome | Cidade 1 | Pedro |Belo Horizonte 2 | Ana |Vitória I have the following…
-
0
votes1
answer154
views.Parameters.Append . Createparameter is not passing the second parameter
I have a system in ASP Classico, and I’m trying to run a SQL Server process passing two parameters. Originally I was only passing a date selected on a datepicker and it worked, now I want to pass an…
-
0
votes4
answers1278
viewsDifficulty with MSSQL and PHP on Centos 6 server
I cannot run a PHP system on the server (Centos 6). When I try to connect to a MSSQL database the following error appears: Call to undefined function mssql_connect() My localhost works normally. The…
-
0
votes3
answers258
viewsHow to generate SQL in relationship table without repeating values?
I have the following scenario: Tables: Video (id, url) VideoCategoria (id, id_video, id_categoria) Categoria (id, descricao) I need to get the last 120 categories that received videos. On the same…
-
0
votes3
answers2517
viewsHow to connect PHP 5.6 to Sql Server 2008?
I need to connect to a MS Sql Server 2008 BD with PHP 5.6 Have Development: Windows 7 64bits, with xampp Production Centos 7 I installed the Microsoft drivers. With this line of code $c = new…
-
0
votes1
answer242
viewsHow to delete a table from SQL Server "memory"
I had a table called tb_state in an SQL Server database and deletes it, when trying to create a table with the same name the system returns error stating that it already exists, how do I delete the…
sql-serverasked 9 years ago Mayllon Baumer 586 -
0
votes1
answer60
viewsGetdata VB.NET function
I’m trying to create a function to update Datagridview. I added the following code but gave an error "Unable to clear the list" Code: Private Sub GetData() Try con = New SqlConnection(cs) con.Open()…
-
0
votes2
answers62
viewsDoubt using RIGHT JOIN in Sql Server
How could I return the results of these three tables, even if I did not have a relationship between them. I thank you SELECT A.IDPLANOCONTAS, A.NUMERO_CONTA AS NUMERO_CONTA1, A.DESCRICAO_CONTA AS…
-
0
votes1
answer53
viewsRun SQL precedent that disables dates in Datepicker
I have a system with a datepicker, and I want some dates to be automatically disabled. These dates should automatically populate the array that disables the dates. (Today it is manual as shows the…
-
0
votes0
answers91
viewsInstallation MSSQL 2014 express or MSSQL 2016 PREVIEW
I have the following problem.. I installed MSSQL 2016 Preview on a server that I can only access via Terminal Service Windows Authentication - Administrator The problem is that everything I find to…
sql-serverasked 9 years, 1 month ago Gustavo Castilho 392 -
0
votes1
answer106
viewsSubquery returned more than 1 value. This is not permitted when the subquery Follows =, != , <, <= , >, >=
I have a Procedure that sends email with the table data, including the email that will be forwarded,but it is sending to only the 1 record, the second it passes straight, and she is in Loop…
-
0
votes1
answer68
viewsSearch larger SQL sellers
I need an SQL code that shows me the best sellers but in the result show me which store this employee belongs to. I can do the research to find out which are the best sellers but I don’t know how to…
sql-serverasked 8 years, 11 months ago edson 1 -
0
votes1
answer275
viewsParameter-based query in SQL Server
I have a situation where I need to bring results depending on the parameter reported. If I gave you any number, which would be the code, it would only bring the result that has the code. If I didn’t…
-
0
votes0
answers43
viewsCan I use the result of the Case clause as a field in Select?
This question refers to this: How to return day of week and time formatted sql server 2008? I’m trying to fix it: SELECT CASE DATEPART(DW, GETDATE()) WHEN 1 THEN 'DOMINGO' WHEN 2 THEN 'SEGUNDA' WHEN…
-
0
votes1
answer261
viewsHelp with Editing PHP PDO
I’m pulling data from a table in sqlsrv to an html table because I often need to edit this data in that table. So I created a php edit function to edit the table row on another page only that is not…
-
0
votes1
answer75
viewsSQL Server and JSON to generate Highmaps: query very long and difficult to handle
I built the query below to have a JSON output for Highmaps (Highcharts), but it is very laborious and I would like to modify, if possible so that it is smaller and easier to change it: select…
-
0
votes1
answer75
viewsError connecting between BD tables
I’m trying to link the lesson table to the fouls. I am using the table "Licao_faltas" to make the connection, but it is not letting me connect the "faltas_Id" of the "licao" to the "licao_faltas"…
sql-serverasked 8 years, 10 months ago lemario 429 -
0
votes2
answers895
viewsConvert sql server data format
Well, I need to convert the data in sql server to dd/mm/yyyy I need an update or something that can help me. Screenshot of the table column below, as it is now: I need you to stay 03-10-2016 for…
sql-serverasked 8 years, 10 months ago KevinF 1,332 -
0
votes1
answer279
viewsHow to modify the server user and folder in Sqlserver 2014
I would like to know how to modify the server’s user and password and to modify the location where the server is saved after installing SQL server 2014 in windows 10. I’ve searched several sites but…
sql-serverasked 8 years, 10 months ago Leonardo Gustavo Maran 93 -
0
votes0
answers109
viewsDoctrine2 + pdo_sqlsrv createQueryBuilder Order By with varchar field does not work
I’m creating a method that takes values for createQueryBuilder() from parameters. I tested in my local database with pdo_mysql driver and it worked perfectly, sorting both by a field of type int…
-
0
votes1
answer1538
viewsSelect min() returning value other than 0
I need to make one select where you take the lowest value found, other than 0 (zero), SELECT MIN(VALORTARIFA) MENORTARIFA FROM TABELA In the above command, if there is some value 0.00, it will…
-
0
votes0
answers194
viewsProvider: SQL Network Interfaces, error: 26 - Error Locating Server/Specified Instance
Hello friends, I am making a web application with Entityframework using Codefirst and every time I try to access, add or edit data has given the error below. Can anyone help me? I work with…
-
0
votes1
answer58
viewsSQL Server Transaction Replication - Primary Key
I have an environment with 2 branches, each branch has to have an application server with an SQL SERVER installed, I have configured the transaction Replication which is working perfectly, but if 2…
-
0
votes2
answers160
viewsProblems finding table in sql
When I use o Select * From table_x and I’ll put my table, the SQL cannot find the specified table?
sql-serverasked 8 years, 9 months ago Isaque 1 -
0
votes1
answer51
viewsMaintenance plan SQL Server 2014
I created a master plan in the bank of the company in which I work, the same is dealing with the following options: Check Database Integrity Shrink Database Reorganize Index Rebuild Index Update…
-
0
votes2
answers88
viewsHow to update the last name of a person who starts with the initial 'Fabio%'?
It is possible to do this, I have a name of a person who is 'Fábio Mello' and I want to update the name that starts with 'Fábio%' to have the last name '%Borges' as I do this query? update pessoa…
-
0
votes0
answers688
viewsError in Discriminator Column EF code first
I am doing a project in Asp.net, I am using classes in C# to make the connection with the bank, however, every time I try to insert a user in the bank, generates the following error: invalid…
-
0
votes0
answers165
viewsEncoding problems in java
I have a classic encoding problem, I’ve done several tests, but nothing solved. The problem only occurs with data brought from the database in Sql Server, with the text fixed on the screen ta…
-
0
votes0
answers176
viewsMSSQL: SQLSTATE[] (null) (Severity 0) after loading 1000 lines
I have some reports where I need to perform new SQL queries in the loop. These reports are running in PHP and datatables. In some moments, when the number of lines reaches a volume greater than…
-
0
votes3
answers3825
viewsFormat date in SQL SERVER
I need to make a SELECT in my SQL Server 2008 database and I’m not getting it. I need to convert a date to the formatted one yyyy/MM/dd HH:mm:ss, however I need to convert in any way that works in…
-
0
votes2
answers173
viewsStrange Comic Book Behavior - Too Many Records
The problem is that this returns me 8 records while in the database there are only 2. That is to say 4 for each 1. I cannot understand why. (If you want to edit the title of the question) I got this…
-
0
votes1
answer146
viewsMerge between multiple Databases
I have a canteen system that performs sales in different schools. This system only works online, saving the sales movements on the matrix server (MS SQL). To optimize the system, I would like to…
-
0
votes1
answer807
viewsConvert the result value of the sql query
I have the query that return me two results where I would like to format it to came in the proper format. How could I do this? select *, sum(valor) as ValorSoma, count(pedido) as QtdPedido from…
-
0
votes1
answer1241
viewsHow to concatenate variables
Dynamically, I am capturing the name of the columns where it appears in two tables to after this effect an Insert with table values_A in the tab_B. Using the resource CURSOR, I get the columns…
sql-serverasked 8 years, 9 months ago Marcelo de Andrade 7,261 -
0
votes1
answer216
viewsImport sql server backup from another server
I can not import a backup (.Bak) in sql generated on another server, says that the database is not equal to what I am trying to import and tals, and I put the same name. Does anyone know what might…
-
0
votes1
answer1456
viewsHow to run Trigger sqlserver
How can I execute a Trigger in unit tests. I have a Trigger I have a Rigger as an example: ***-- Create one trigger with two inserts:*** create trigger trg_I_Table_1 ON Table_1 FOR INSERT as insert…
-
0
votes1
answer101
viewsInsert apostrophes with variables
I am performing a query through a value stored in a variable. This variable is declared DECLARE @it_codigo varchar(max) and gets value from a field ntext from another table, through a previous.…
-
0
votes3
answers688
viewsSelect with various Procedures
Good Morning, How do I perform the select with several processes? I have a process that returns 3 measures of 1 month specific. Now I need to run this proc 12x in select. Type: SELECT (SP_JANEIRO),…
sql-serverasked 8 years, 7 months ago CoDoRNeX 1 -
0
votes1
answer70
viewsHow to "truncate" table to restart from the smallest auto increment value
To tabela_A has a field id auto increment. I need to clear the table with something similar to the command truncate only that cleaning only the record from the id = x. For example: id col1 1 A 3 B 4…
-
0
votes1
answer358
viewsHow to set the boot value of a PRIMARY KEY field set to IDENTITY in SQL Server?
In Mysql when creating a table with an AUTO_INCREMENT field being PRIMARY KEY it is possible to define what will be the initialization value of the first record of the same, as follows the script…
-
0
votes1
answer131
viewsConnect to Sqlserver using Windows 10?
I am using Windows 10 and have to connect to a Sqlserver 2000 database using the command line in a java application. However, I am receiving an error. run: ClassNotFoundException:…
-
0
votes1
answer61
viewsDoubt with for no sql server 2008 command
I have the following situation, 5 discount fields that receive the discount name 01 until 05. this sql query works below (1), makes the correct calculation only when it has only 1 of the filled out…
sql-serverasked 8 years, 9 months ago Harry 3,805 -
0
votes1
answer80
viewsQuery in SQL Server
When doing the sequinte query select * FROM conta It brings me the columns, being that the id_fornecedor comes from the table fornecedor id | id_fornecedor | conta_status 1 | 1 | S I would like to…
-
0
votes0
answers157
viewsdatasource Connection, error while climbing Jboss
I am trying to make a data source connection on Jboss, but without success. I saw this tutorial to create my connection. Then the error occurred: Configurationpersistenceexception: Failed to parse…
-
0
votes0
answers285
viewsHibernate, JPA and SQL Server ERROR
I can’t get my application up. Below the stack, persistence and pom. Stack 22:25:32.131 [main] ERROR o.h.tool.hbm2ddl.SchemaExport - HHH000231: Schema export unsuccessful…