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
-
6
votes2
answers687
viewsHow is the query generated in Linq mounted when we do UPDATE?
How the query generated in Linq is mounted when we do UPDATE? using ColWebDBContext.DBase.Banco; using System; using System.Web.UI; using System.Linq; namespace DBContext { public partial class…
-
6
votes1
answer2140
viewsHow to remove spaces leaving only one?
Considering a variable with a text in SQL Server. How can I remove 2 or more spaces within the text? In this case leaving only 1 space. For example: '1 tigre, 2 tigres, 3 tigres' It should result…
-
6
votes1
answer1069
viewsDifference between temporary table and variable table type
In the Sqlserver there are temporary and variable table type resources. What would be the most advantageous or the best option to put in a Procedure which inserts the query that was returned from a…
-
6
votes1
answer2181
viewsIdentify if a string is capitalized in sql server!
I have a field in a table that must be filled all in lower case, but the user being user filled some lines in upper case. I want to identify what records are like this so I can request correction. I…
-
6
votes5
answers16830
viewsHow do I list all tables with their respective databases?
I would like to list all the tables in my database that ends with a specific name and also all my databases that match these tables. I tried to do it but nothing comes back. Query SELECT da.name AS…
-
6
votes1
answer1546
viewsHow to round up time?
I have the following function which treats an hour coming from the bank: SELECT f.chapa AS chapa, f.nome AS nome, f.secao AS cod_secao, f.nsecao AS desc_secao, c.codigo AS cod_funcao, c.nome AS…
-
6
votes2
answers670
viewsAn Exception of type 'System.Outofmemoryexception' occurred in mscorlib.dll but was not handled in user code Asp.net
I’m having a hard time solving this mistake. My goal is to collect data from an Excel file and store it in c#variables, which in turn will be inserted into SQL Server 2012. Reading is done line by…
-
6
votes2
answers1493
viewsSyntax difference between databases
What is the difference, in the syntax, of the following databases, for a simple query, of the type: SELECT * FROM tabela WHERE id = '1' ORDER BY nome GROUP BY nome LIMIT 1 Or, what do they differ…
-
6
votes2
answers43536
viewsError doing Insert - String or Binary data > would be truncated
By making this Internet: INSERT INTO t_cmo_oit1980_leitura(id_oit_let,id_oit,rx_num, dt_rx) SELECT (1), (SELECT id_oit FROM t_cmo_oit1980 WHERE id_oit = 6574), (SELECT rx_num FROM…
-
6
votes2
answers1906
viewsConvert and save photo in BD
I am working on a project where I have to save some photos. So I am studying the best way to accomplish the task. I thought about saving in the database, because these photos will be accessed both…
sql-server asp.net-mvc-5 winforms image-processingasked 7 years, 6 months ago Thomas Erich Pimentel 3,059 -
6
votes1
answer200
viewsSearch for people with similar names
I am developing code to search for people names intelligently using SQL SERVER LIKE operator. In names like Souza and Sousa just use brackets [] Ex.: select * from pessoas where nome like 'joão…
-
6
votes1
answer662
viewsSQL Server Data Dictionary
Hello, I come from Oracle culture and want to learn a little SQL Server, I’m having difficulty finding the data dictionary of SQL Server, I’ve searched in other forums and found nothing. In Oracle…
-
6
votes1
answer169
viewsIs it possible to inform the size of the VARCHAR in a Namedparameter?
I’m working with a tuning of an SQL Server database. Through the query below, I can see how the bank executed some of my heaviest queries. SELECT TOP 30 deqt.TEXT AS Query, last_execution_time FROM…
-
6
votes1
answer400
viewsHow to return the last value of an sql string?
I need to use the last character of a string G. Like I get it with sql server? SET @VALOR = '0000050529-G' I want to take the letter G
-
6
votes2
answers905
viewsHow to create a sequential number that does not repeat, per user
Work on a bill issuance project, in this project exists the entity Emissor. My database Sql-Server may have several emitters. Each issuer can issue their tax bills. Each invoice shall have a…
-
6
votes2
answers1334
viewsSQL decimal field size
I am making a form, and in the database documentation there are some numerical fields that are divided into 2 parameters. Ex: Field: Cost Type: NUMERIC Tam.: (12,4) What does this size divide and…
-
6
votes3
answers3659
viewsIn Trigger we have INSERTED and DELETED. Why not "UPDATED"?
Example scenario: I have the table/fields: documentos id documento pessoa item qtd valor The system gives INSERT and then UPDATE on this table in a continuous sequence (which would not come to the…
-
6
votes2
answers256
viewsConcatenate columns and return the relation by SELECT
Suppose I have the following tables and their relations: Tabela A Col 1 Col 2 Col 3 Tabela B Col 1 Col 2 Col 3 Tabela C Col 1 Col 2 Col 3 Tabela D Col 1 Col 2 Col 3 Relacionamentos: A (col 1)…
-
6
votes1
answer57
viewsselect with order by
I have a simple table with only one text field, no field auto increment and indexes CREATE TABLE teste (Nome varchar(30) NOT NULL) I inserted the information in this table in the following order:…
-
6
votes3
answers1299
viewsShould every table have Primary key?
I believe my question is both conceptual and technical. My whole problem started when I made an SQL Server database and in it there were some tables without primary key, such tables would serve…
c# asp.net-mvc sql-server entity-framework entity-framework-6asked 5 years, 5 months ago Nelson Francisco 147 -
5
votes2
answers4407
viewsIn SQL Server how to convert string uppercase part lowercase based on tab: ?
I need to make a script to convert all user records into a table in this format (single field): INFORMATICA\desenvolvedor ADMINISTRACAO\contador That is, before the uppercase bar and after the…
-
5
votes1
answer2375
viewsWhat is Rameter Sniffing?
I’ve heard of Parameter sniffing. Something to do with SQL Server, stored procedures, and parameters. But what exactly is?
-
5
votes4
answers1585
viewsHow to make a "Generic Trigger" in SQL Server?
Hello I have in my database in all tables the following fields Datetime Criadoem | Datetime Modificadoem I wonder if you have a way to make a generic Rigger to control these fields, because when…
-
5
votes2
answers7608
viewsHow to create a Rigger that is fired every time you have an insert event in the table?
I need to create a Trigger that is triggered every time there is an insertion event in the table, before the insertion is made, it checks a condition, if the condition is met it changes the value of…
-
5
votes5
answers36671
viewsHow to get the total character size of an SQL column?
I want to take the total size of characters that a column supports, example INT supports 10 characters. I tried to use DATALENGTH that does not return the number of characters, but the amount of…
-
5
votes1
answer7721
viewsHow to change the language of Microsoft SQL Server Management Studio?
The image file . ISO of Microsoft SQL Server 2014 Enterprise available for download through Microsoft Dreamspark exists only in version en. Could you change only the language of the Management…
-
5
votes3
answers51716
viewsSQL Server - Check duplicate data in two simultaneous fields
DBMS: SQL Server 2014; Problem: I need to know which records are duplicated, so that it is checked in two simultaneous fields, that is, if the field "CPF" with the value '83971465842' and the field…
-
5
votes3
answers18734
viewsCalculate Difference between Dates in SQL Server, with Years, Months and Days output
What would be the SQL (SQLSERVER) that could extract the difference between two dates (the largest being the current date of the system) with output of Years, Months and Days?
-
5
votes1
answer677
viewsHow do I create scheduled events in SQL Server, similar to Mysql’s "Event"?
In Mysql I used this syntax to create a scheduled event: CREATE EVENT 'evento_LimparPaper' ON SCHEDULE EVERY 1 MONTH STARTS '2014-06-3 00:00:01' ON COMPLETION NOT PRESERVE ENABLE COMMENT '' DO BEGIN…
-
5
votes1
answer192
viewsDatabase Allocation
I have some questions regarding my database. I use an MS-SQL "database", which is provided by Locaweb (I don’t have very clear this concept of Locaweb providing me with a "database" which has within…
-
5
votes1
answer68
viewsIsolated Storage or SQL Server Compact
I’m making for Windows Phone 8.1 something similar to a dictionary where there will be a lot of text with sort, search, sort by name. Bearing in mind that there will be this large amount of…
-
5
votes5
answers15132
viewsChange NULL value in SQL SERVER
How to change the NULL value in sql server to for example 'NONE', how to fix it ? My result is coming like this: Florida United States NULL 16 Nevada United States NULL 17 Nevada United States Cell…
-
5
votes1
answer961
viewsCustom auto increment
I have to generate an auto increment of the type "000"+id, but I can not get to something concrete, my base is this below, I wanted only a light even of how to do, I do not need the answer itself.…
-
5
votes3
answers1405
viewsHow to export SQL records without duplicates?
I’m trying to remove some duplicate records from a table and I searched the Internet for how to do that, and I found something about distinct. My scenario is: I have a table that has a record with…
-
5
votes2
answers844
viewsCONSTRAINT that adds parameter to FOREIGN KEY?
I have the following code for creating tables: CREATE TABLE pessoa ( cod_pessoa int NOT NULL IDENTITY PRIMARY KEY, nm_pessoa varchar (50) NOT NULL, tp_pessoa char(1) NOT NULL, endereco_pessoa…
-
5
votes2
answers9964
viewsPivot dynamic columns
I need to display this: Thus: Following the instructions of the links s: Use PIVOT operator without aggregation I cannot place a subquery inside the IN in the PIVOT Dynamic pivot with SQL Server I…
-
5
votes5
answers25936
viewsHow to pass a list of values to a Stored Procedure?
I’m creating a stored Procedure in SQL Server 2008 R2 and would like to pass a list of values per parameter, for example: Table produto ---------------- | id | nome | | 1 | maçã | | 2 | pera | | 3 |…
-
5
votes1
answer309
viewsRetrieve information about which Tables/Procedures/Views are most accessed in SQL SERVER
select db_name(database_id) as banco, object_name(object_id) as objeto, stats.user_seeks, stats.user_scans, stats.user_lookups, stats.user_updates from sys.dm_db_index_usage_stats as stats I have…
-
5
votes2
answers6301
viewsRemove an item from a List<>
Well, I have a method that I consult at my bank and compare with a List<Carros>. My intention is, for every item that contains as much in my query as in mine List<Carros>, I remove the…
-
5
votes2
answers1099
viewsHow to remove formatting from the GETDATE() command
I am developing an application that will be used by several customers simultaneously, I would like to use as id the Day, Month, Year, Hour, Minute, Second and Millisecond, would have as I remove the…
-
5
votes1
answer643
viewsHow to connect to the Azure Database?
Well friends, I have a database on Azure, but I can’t connect to it. The error is that my IP is not authorized to perform such connection, what I did was add a new rule to the firewall of the…
-
5
votes1
answer406
viewsHow to map a TIME-like column in Entity Framework 6?
I am using this mapping to a SQL Server DATETIME field: Property(X => X.DatNascimento).HasColumnName("DAT_NASCIMENTO").HasColumnType("datetime"); But I have another field that is only TIME that I…
-
5
votes2
answers9506
viewsHow to connect PHP to Sqlserver via PDO
I’m using the following code: try { $con = new PDO("sqlsrv:Server=172.20.21.193,9090;Database=sgt","deb","123123"); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch…
-
5
votes1
answer9051
viewsWhat are the SQL Server Express and Mysql limits?
What are the limits of SQL Server Express and Mysql? How many bases are possible? What is the size of each database? The size of the index files?
-
5
votes3
answers899
viewsConvert data c#
Good people I’m having a problem with my code. I in my database have a field like date Only that after calling him to the program he also passes me the time , is something of the genre: 18-03-2015…
-
5
votes2
answers157
viewsWhat’s position on Sqlserver?
I have a question. I received the layout of a table containing: Nome do campo | Tamanho | Posição | Tipo The Position contains: De | Até And one of the fields is: Histórico ( no caso da Posição ):…
-
5
votes1
answer1484
viewsError connecting to SQL Server using Codeigniter
I have an error when connecting the database in my Codeigniter project, I am using SQL Server. $db['sql'] = array( 'dsn' => 'DRIVER={SQL Server}; SERVER=HOSTPT-01407; DATABASE=localidade;',…
-
5
votes3
answers2237
viewsChange column to indentity using T-SQL in SQL Server
I need to change an existing column in a table so that it stays with the property identity using T-SQL and then entering data into this table. The column already contains data and after this…
-
5
votes1
answer151
viewsIs there a way to name the selected tables from a stored database to identify them in the Dataset?
I have a Store Procedure in SQL Server that projects various data. Example: CREATE PROCEDURE [dbo].[teste_sp] AS BEGIN select * from compra select * from cliente select * from fatura END However,…
-
5
votes3
answers16008
viewshow to update column with single quote sqlserver
I’m needing to update a column that has lots of simple quotes in the field, content with the letter was inserted so it has several tags of the type <span style="FONT-SIZE: 12pt; FONT-FAMILY:…
sql-serverasked 9 years ago hyperpixel 389