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
-
1
votes1
answer388
viewsProcedure does not return the select data
I created a simple process, it takes a parameter and should return the data according to this parameter: CREATE PROCEDURE [dbo].[testeLike] -- Add the parameters for the stored procedure here @teste…
sql-serverasked 8 years, 5 months ago HeyJoe 819 -
1
votes0
answers48
viewsHow to create server certificate in SQL Server?
I’m creating an app that uses SQL Server as a DB manager. My problem is in making a secure connection between the DB and the application, so I need to create a server certificate within the SQL to…
-
1
votes1
answer108
viewsUse VB6 app on a smartwatch
It is possible to create an application for the smartwatch in which the application is already done in Visual Basic and has the BDA in SQL Server? The goal is for the user to be able to see the data…
-
1
votes0
answers42
viewsGet textview value through gridview/sql server
I have a single column gridview consisting of four textviews and I am loading values from an SQL Server database into it. How do I click on a grid line to show another field (associated with the…
-
1
votes1
answer70
viewsHow to use having together with view in sql server
When trying to use the HAVING in an SQL query is returning the following error: Mensagem 8121, Nível 16, Estado 1, Linha 15 Column 'V_DADOSFUNC.FILIAL' is invalid in the HAVING clause because it is…
-
1
votes2
answers54
viewsConversion of SQL Server types
I got the following SELECT in SQL Server: SELECT th.CidadeCod, th.ContratoCod, CONVERT(DECIMAL(5,2), ( SUM(th.PlacasLidas)/SUM(th.Trafego) ) * 100) AS [IndiceOCR] FROM controle.TrafegoFaixaHora th…
-
1
votes4
answers594
viewsReturn value in SQL Server query
I need this appointment to return 2 instead of A. TIPOUSUARIO is the varchar type. someone can tell me where the mistake is? USE DATABASE SELECT TIPOUSUARIO FROM TABLE UP (NOLOCK) WHERE TIPOUSUARIO…
-
1
votes1
answer334
viewsHow to merge 8 query returns into one?
I have 8 query’s all have 5 unusual columns and some distinct columns, Based on the common columns I can display a single result of the 8? Common fields: F.CHAPA AS CHAPA, F.NOME AS NOME, F.FILIAL…
-
1
votes1
answer584
viewsCreate Precedent to adjust price as per conditions (SQL Server)
In a comic book of a bookstore need to create a precedent to readjust the price column according to the percentage and gender reported (using transaction control). Like I should do? create table…
-
1
votes1
answer4608
viewsHow to compare a date of type datetime?
I have a date in a patient table in the Sql Server database in the following format: datetime (01/01/2016 12:50:00.000) I want to check if the patient’s appointment time has arrived. For example:…
-
1
votes2
answers55
viewsReturning only one select at a time multiuser
I have several clients connected to a bunch of data. These customers make inquiries, almost at the same time, causing me headache, when 2 customers catch the same result of a select. How do I know…
-
1
votes1
answer136
viewsINSERT inside WITH clause
I basically learned SQL from Postgresql, I’m making use of SQL Server for the first time and I couldn’t figure out how to do it. Let’s say I have two tables. The first is a generic table of…
-
1
votes1
answer96
viewsHow to execute a select within an IF/CASE condition?
would like to know how I can use a select as a true or false condition within a case or IF: The query to return true or false is this: SELECT * FROM Funcionario f WHERE (f.Email IS NULL OR…
-
1
votes0
answers131
viewsLinked Server SQL Server Optimization
Currently has an environment that has 4 servers with database. I need to gather some information from 3 servers in 1. Example: The servers are: To B C and D I need to get some information that’s on…
-
1
votes2
answers823
viewsHow to create a FOREIGN KEY using uniqueidentifier in SQL Server
Hi, I’d like a hand. I have a table on SQL Customer call, which has as primary key a type uniqueidentifier Ex: Create table Cliente ( ClienteID uniqueidentifier not null, Nome varchar(50) ) I’d like…
-
1
votes1
answer192
viewsWhat is the difference between freetexttable and containstable
I am mounting a query that will need to take the term typed in a search and make a query by similarity proximity in the content. Is being used a "rank" that is generated with the use of these…
sql-serverasked 7 years, 11 months ago DiChrist 4,567 -
1
votes2
answers317
viewsError creating database by Visual Studio 2015
I’m in trouble when I try to create a database by Visual Studio this message appears:…
-
1
votes2
answers1514
viewsCalculate length of a Sqlserver field
Hello, I have a table in SQL with the word column and a column sizeDaPalavra, I was wondering if you have any way to register the word in the database and execute a function that calculates the…
-
1
votes0
answers866
viewsHow to list data with Inner Join with mvc 5, c#, Dapper, and sql server?
I’m having the following difficulties: 1 - Data display from a select with Inner Join. The fields of the other tables do not appear all that are in select, and the ones that appear, have the value…
-
1
votes1
answer66
viewsBKP Sqlserver does not run when executed by a trigger(Trigger)
I have a trial that runs a bkp from my database. If I run it by Sqlserver the bkp is normally performed But when I call for a Rigger, another trial or application the bkp is not realized, the folder…
-
1
votes0
answers169
viewsFalse positive on . exe from visual basic software
I’m new to the forum, so I’m sorry if I’m repeating a topic (I researched it actually and I couldn’t find anything that looked like the problem I’m having). Anyway, I’ll explain what’s going on: I…
-
1
votes2
answers74
viewsHow to use @in SQL SERVER?
I need to recover the quantity of product with price between 0 and 10. Error in variable @W_NUM of select command. BEGIN TRANSACTION; DECLARE @W_P1 int; DECLARE @W_P2 int; DECLARE @W_NUM int; set…
sql-serverasked 7 years, 11 months ago Orlando 83 -
1
votes1
answer1253
viewsPIVOT SQL - Dynamic Columns with Variable
I have a table which I turn rows into columns with PIVOT. 'Chumbando' the name of the columns, works very well, however I will need to do this dynamically. There is the possibility to use variables…
-
1
votes1
answer218
viewsPrecision scaling using Entity Framework and SQL Server
There’s some time I’ve been noticing, something strange when saving values double in the SQL Server database with the Entity Framework. I noticed that when reporting a value ex: 12.23 after…
-
1
votes1
answer2207
viewsEffect select with dynamic column
I have a consultation with N relationships, in one of these related tables I need to select a specific column that follows the pattern mes_valor, where mes is an abbreviation for one of the possible…
sql-serverasked 8 years, 2 months ago Marcelo de Andrade 7,261 -
1
votes1
answer285
viewsHow to use an Oracle database and Sql Server simultaneously with Entity Framework 6 in a single application?
I am developing an application where the information will be persisted in two databases, one MS SQL Server and one Oracle. I have no option to use both banks in the same DBMS, because the Oracle…
-
1
votes1
answer457
viewsAsp.net and C# problem image gallery to display the photo
I’m having trouble displaying the photo in the browser the Repeater brings all the database information except the photo. I entered the data manually in the database. //TABLE CREATE TABLE…
-
1
votes2
answers334
viewsCheck Consistency of a SQL Server backup in C#
How can I verify the integrity of the backup file of an SQL Server database in C#?? I used the following namespace and classes to generate the backup: Microsoft.SqlServer.Management.Smo {…
-
1
votes1
answer59
viewsCalculation of string occurrence
I have a table with 3 columns id, nome and voto. They’re populated with a lot of records, and I need a calculation to return the name with best "balance" of votes. The column voto can only receive…
-
1
votes1
answer194
viewsHow to delimit a string field for use in the IN clause
In the tabela_A own a field cod_canal where is a INT, in tabela_B own a field canais of the string type and separating the codes by ,. Example: 1,3,6,9,12. On a first attempt, I just thought I’d…
sql-serverasked 8 years, 2 months ago Marcelo de Andrade 7,261 -
1
votes1
answer58
viewsHow to work with more than one dropdownlist to mount a C#URL?
I have the following dropdownlist where in the first person chooses whether to rent or sell immovable. The consultation in the bank is being done as follows: public List<Imovel>…
-
1
votes2
answers323
viewsSyntax error in SELECT WHERE using ADO.Net parameters
Someone understands this mistake and gets a solution? Code: OleDbConnection ConSelect = new OleDbConnection(); ConSelect.ConnectionString = Properties.Settings.Default.dbInvoice; ConSelect.Open();…
-
1
votes1
answer113
viewsMultiple sharing users when installing SQL Server
I recently installed the SQL Server Express 2016 on my machine with Windows 10. After a while I realized that on the menu "Share with" windows appeared 13 new entries in format SQLEXPRESSNN, where…
-
1
votes2
answers3503
viewsHow can I count fields that are NULL?
I’m using this query: I would like to know how to count these fields that have no records. Here returns 0. But I have some null records. What I do? SELECT DataFim, COUNT(DataFim) AS QTD FROM…
-
1
votes1
answer3398
viewsForeign Key Sql Server
I have a question about Foreign key in the following situation: Tehno table UF, with 3 columns: ID_UF (PK), Cod_uf (int) and Descuf (nvarchar(50)) I have another table called IDE, with 3 columns:…
-
1
votes1
answer602
viewsExchange accented characters for accented characters
There’s some kind of method of me making a replace in characters based on CASE? I’m looking for something like this: UPDATE foo SET bar = SUBSTRING(bar, "Ã","ã"); -- se o caracter for LOWER -> ã…
-
1
votes2
answers394
viewsCompare a null bit column
I know that the results of the queries below are the same, but I would like to know if there is a difference in the execution by Sqlserver on performance issues and etc. SELECT * FROM CLIENTES C…
sql-serverasked 7 years, 8 months ago Rafael Tomitão 11 -
1
votes1
answer812
viewsHow to use CASE WHEN in an IN statement?
In a query I am gathering data on representatives, customers and sellers. Some representatives have sellers, who in turn have customers. These cases are exceptional as clients are directly linked to…
-
1
votes1
answer212
viewsFill in textview android studio/sql server
Good guys, can’t fill a textview using a sql server database. Can anyone help me? Here’s what I have on onCreate: connectionClass = new MainActivity(); text = (TextView)…
-
1
votes1
answer192
viewsSET ENABLE_BROKER taking too long to run
I executed the command ALTER DATABASE [Banco] SET ENABLE_BROKER; but it’s been running for over 20 minutes and counting. It would have a faster way to execute?
-
1
votes2
answers454
viewsHow to convert Float to String using LINQ for Entity?
How to convert Float to String using LINQ to Entity? I need to convert a field from my database that has the float type to the string type in my C# using the LINQ. Try using Convert.Tostring,…
-
1
votes1
answer190
viewsProblem saving Dropdownlist information to the database
I’m having trouble saving information in the dropdown by btn-save I have a property registration form and the information entered in the dropdown occurs only that at the time I save on another page…
-
1
votes1
answer923
viewsSQL query to return only if capitalized
I would like to make a query in a column and that the return is only the uppercase words that correspond to the searched criteria (user input), no matter if the criterion was typed in uppercase or…
-
1
votes2
answers780
viewsError Insert PHP OO Sql Server sqlsrv_query() expects Parameter 1 to be Resource, Boolean Given in
Guys this Class is giving me a work I confess to you that I see no error here, I have seen in php.net I believe that I am following all the logics and syntax. If anyone can help me solve this…
-
1
votes3
answers14296
viewsExport SQL Server query to CSV file
I need to somehow export the result of my SQL query to a CSV file. However, it has to be directly via SQL or VBS. Or else, all database table data can be exported to CSV.
-
1
votes3
answers2405
viewsExport query output as Insert scripts
I would like to export the result of a query in SQL Server as an Insert script to insert the data in another database. I know there is the option to export the whole table through the "Tasks ->…
sql-serverasked 7 years, 6 months ago Washington da costa 1,029 -
1
votes1
answer107
viewsHow to select in c# using data base / Sql-Server?
In a previous question, I needed to select a specific date: How to select a date in c#? Now I need to make a select that brings the records whose date is within a specific week or month. How should…
-
1
votes2
answers904
viewsGenerate empty row (null) in sql server
I don’t have much knowledge of sql, but I need to do the following procedure: User gives a number. Sql generates the amount entered by the blank/null record user. After generated the blank records,…
-
1
votes1
answer106
viewsError change password on login system with PHP SQL Server
Good afternoon, I’m having a big problem where I can’t get the password in the system. What is bugging me is that it seems that sqlsrv_fetch_array works differently from mysql_fetch_array, I have a…
-
1
votes0
answers60
viewsFill gridview checkbox via SQL Server
I have a checkbox in gridview and I want to load fields of type 'bit' in the SQL Server bd at this checkbox, or if it is 'True' the checkbox is 'check.' I have this: connect = CONN(un, passwords,…