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
votes2
answers126
viewsView Not Updatable in SQL Server
How to make a View not upgradable in SQL Server, because I’m not finding documentation that contains such a script.
sql-serverasked 7 years, 7 months ago Brenin_rice 17 -
1
votes1
answer619
viewsSelect that does not return SQL blank
select 'TEM' AS InSituacao from GTCLogist where NrPlacaCarreta = '' and ID <> '35514' and year(DtBase)=year(GETDATE()) and MONTH(DtBase)=MONTH(GETDATE()) and DAY(DtBase)=DAY(GETDATE()) I have…
-
1
votes1
answer8493
viewsGenerate Excel in SQL SERVER
Good afternoon. I need to generate an excel file by SQL SERVER. And I need to specify the data type of the cells in that file. For example, in the value cells, set the data type to "R$" for example.…
-
1
votes1
answer642
viewsDifference of days between records and display only results > that 14
I have the following appointment: SELECT V.CHAPA, F.NOME, V.DATA, DATENAME(dw,V.DATA) AS DIA, MAX(V.SEQUENCIALBATIDA) AS BATIDA FROM ARELBATIDATRANSITOVIEW AS V LEFT JOIN V_DADOSFUNC AS F ON V.CHAPA…
-
1
votes4
answers11284
viewsHow to create temporary mirror table in another
It is possible to create a mirror temporary table in another? Example: Let’s say I have in my bank a table with 60 fields. I would like to create a temp with the name #table with the same table…
-
1
votes0
answers26
viewsOutput MS SQL server bandwidth
I have a MS SQL server, with 14 Databases, ranging from 2mb to 20gb. His outgoing traffic through the network is around 92GB/day. I wonder if there is how I monitor to know: Which Databases consume…
sql-serverasked 7 years, 7 months ago Dorathoto 7,426 -
1
votes0
answers157
viewsSome questions with the Microsoft Sync Framework
I’m thinking of implanting the Sync Framework in a solution that I am developing, but I have had some doubts about the functioning of the Framework, I hope you can help me, I’ll be very grateful.…
-
1
votes1
answer93
viewsUpdate an Access application
What is the easiest way to upgrade an Access desktop application with VBA to a web application with sql server?
-
1
votes1
answer293
viewsHow do I search with a text variable containing apostrophes?
Problem When searching with texts containing apostrophes, no results are found. Execution DECLARE @cidade NVARCHAR(50) SELECT @cidade = cidade FROM tabela_A WHERE id = xv SELECT campo FROM tabela_B…
-
1
votes2
answers950
viewsIf an int variable does not receive anything from select it is zero or not
Let’s say I have this block: declare @teste int declare teste_cur cursor for select campo1 from tabela ..... while @@fetch_status = 0 begin set @teste = 0 select @teste = campo1 from tabela where…
-
1
votes1
answer42
viewsTwo databases communicate with the same template
I wanted to have a database for production and another for development separate the real data from the test environment data. The problem is I have no idea how to do that. I created a clone of my…
-
1
votes1
answer49
viewsRemove first character by Index
Good afternoon. I have a varchar with some numbers set @ID_CUSTOMERNUMBER = '01234567' I would remove the zero only if it is the first number of my variable, example: '0123456789' removing the zero…
-
1
votes2
answers212
viewsRead column values - C#
I need to read the values of a column called Code_article and place them, only when the column is still empty, I execute and immediately gives the error: The object reference was not defined as an…
-
1
votes1
answer416
viewsConnection . dbml - Visual Studio 2017 ( C# + SQL Server 2016)
In Visual Studio 2012, there was an option to create the DB connection file at (Add > new Item ) and then choose the dbml extension file. Where is Visual Studio 2017? I remember it’s something…
-
1
votes1
answer1039
viewsSQL query with SUM, displaying the return in rows
So class I have a question that is consuming my insides. Someone would be happy to tell me how to return a total of records from a query, via SUM (SQL Server) function, displaying the total number…
-
1
votes3
answers2752
viewsComparison of Strings in sqlServer
Good morning. I have two strings defined : '2.9.15' and '2.9.16'; I need to compare them and tell you which one is the biggest. I don’t know how to do.
-
1
votes1
answer2224
viewsQuery the database through a text box
Hello, right now I’m in a part of a project where I have to do a database search through a text box. For example, he searched for "José" and returned all the data contained in the database with the…
-
1
votes2
answers605
viewsTrigger updates only to 1 record
Considering the following trigger: CREATE TRIGGER tgr_vendas_d ON vendas FOR DELETE AS BEGIN DECLARE @valor DECIMAL(10,2), @data DATETIME; SELECT @data = d.data, @valor = d.valor FROM deleted d…
-
1
votes1
answer691
viewsASP NET MVC 5 Dapper with SQL Server?
I’m creating an app with ASP.NET MVC5, DAPPER, C# And SQL SERVER. The problem, is that in the data listing, is bringing the empty fields, except the ID field, which comes zero (0). If anyone knows…
-
1
votes1
answer51
viewsDoubt about data type database
See this table of INT data types in SQL SERVER: tinyint | 0 a 255 | 1 byte smallint |-2^15 (-32.768) a 2^15-1 (32.767) | 2 bytes int |-2^31 (-2.147.483.648) a 2^31-1 (2.147.483.647) | 4 bytes About…
-
1
votes1
answer424
viewsCPF Validation - Integration Services
I am importing a base with Cpfs for my DW but need to do CPF validation inside SSIS. Does anyone have any idea how I can do that? Thank you! Edit: I got it done the way I wanted it. I used the…
-
1
votes2
answers140
viewsProblem with IN condition in sub-select
I have the following problem; I’m trying to do some research and include the value of WHERE major in a sub-select, but the result is always reported as 0, and there are records. Part of query that…
-
1
votes2
answers99
viewsProcedure for storing in backup tables?
I have two tables, sales and salesProducts because of the volume of information in these tables reading/writing operations are slow. I need to create a database that stores this data (from the sales…
-
1
votes1
answer1777
viewsAccess SQL Server base via CMD
In Oracle I know you have how to access and execute queries through sqlplus in CMD. Can anyone tell if SQL SERVER also has a similar command?
-
1
votes1
answer215
viewsLike query returns nothing when you have more than one word in PHP
I’m trying to make a query using like in PHP and when I use a more than one word. It only works if I just put one word. In SQL Server the query works error-free. <?php function…
-
1
votes2
answers334
viewsPower BI and SQL Server
I need to pass an integration budget to an SQL Server, but the work has a condition, the connection to the Power BI site, everywhere I read it does not make clear whether or not it is possible to…
-
1
votes2
answers7642
viewsHow to store information from a SELECT in variables
Good evening community,I have a stock program that I am finalizing and I want to do a validation for him to always check if he has enough of that product before adding to the sale. For this I used a…
-
1
votes2
answers90
viewsDoubt with group by for last record
I want to make a select that brings the grade data of each student, grouped by student and subject, but I want only the result of the last test of each subject. For example a student can take the…
-
1
votes1
answer1631
viewsError opening connection to SQL Server 2008 R2 database
I’m having a problem opening a connection to a local database in SQL Server 2008 R2. The opening method that is giving error is as follows: public static SqlConnection AbreConexao() { string path =…
-
1
votes2
answers509
viewsCapture values from one table and insert them into another
I have a temporary table that fills it with the result of a particular query. Now I need to go through the data of this temporary table, row by row, and take certain fields and insert them into…
-
1
votes3
answers122
viewsIs authenticating users through a form with database connection safe with crackers?
I would like to authenticate my program users using a form with connection to an sql server database but I don’t know if it is a safe way against unauthorized copies. The authentication will be done…
-
1
votes1
answer678
viewsFill class with bank result
Good afternoon everyone. I have a huge need to be able to put together a situation. I have an object DataTable with the result with the column "ID_CLIENTE". I have an object Cliente with the…
-
1
votes1
answer706
viewsSplit date ranges into weeks
Would have some simple way to extract the weeks given a range of dates, for example: Start date: 01/07/2017 end date: 30/07/2017 Given the above dates how could you automate the extraction of the…
-
1
votes3
answers4839
viewsSQL script to create mask
I’m with a client database that with some data without mask for use in my system that is the field NCM; The same has 8 digits ( ex.: 0000.00.00), However the same in my system this maskless…
-
1
votes3
answers75
viewsDoubt with registration grouping
In my example, I have a query that return 3 products and the same were purchased in different orders but I do not need this order number. So I did it this way: SELECT c.prod_pk_id, '61068276007702'…
-
1
votes1
answer62
viewsAzure SQL database refusing connection
I’m having trouble connecting the Azure SQL database via a web application published at this address: http://timesheetacs.azurewebsites.net/Login/Login This is the connection string: <add…
-
1
votes2
answers243
viewsParallelism in Sql Server with C#
I am implementing async methods in C# and would like to know how to proceed when I arrive in Sql. When I open a connection to sql server, does it allow me to parallelize through just one connection?…
sql-server async asynchronous parallelismasked 7 years, 3 months ago Fernando Augusto De Almeida Ba 91 -
1
votes1
answer837
viewsHow to return output varchar from a precedent in c#?
Error that appears: An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code Additional information: Error converting data type varchar…
-
1
votes1
answer674
viewsImport Sql Server Backup and Differential
I’m having a problem importing a backup to the secondary server: The topology: Server Production >> Server contingency. When Full Backup is imported it matters without any problem. The problem…
-
1
votes1
answer387
viewsChange timeout SQL Server 2008 request
I am sending a request inside a database by SQL Server using Winhttp.WinHTTPRequest. 5.1, the problem is that the request is taking too long and is giving timeout error. I would like to increase the…
sql-serverasked 7 years, 10 months ago Jônatas Trabuco Belotti 656 -
1
votes0
answers399
viewsAlter table in giant table
I need to perform an alter table operation on several fields of a table and this table has more than one billion rows. One operation for each field takes approximately 2 hours and now imagines for…
-
1
votes1
answer820
viewshttp post with Bodyrequest Sqlserver
Hello, How do I get a post request by passing an xml as date? tried so on another GET request and it worked: DECLARE @Tabela TABLE ( CampoXML XML); DECLARE @URL VARCHAR(8000) SELECT @URL =…
-
1
votes3
answers634
viewsLike bringing in salesmen who made and didn’t make sales yesterday?
In this select I am bringing all employees who accessed the application yesterday PO.DAT_COLETA and who held blindfold yesterday PE.COD_PEDIDO. But I also want to bring those who accessed yesterday…
-
1
votes3
answers1195
viewsConvert nvarchar(50) field to SQLSRV table datetime
I need to change a field in the SQL database table whose format is in nvarchar(50) and data were saved in date format 07/09/2017, containing values NULL also! I need to convert this field directly…
-
1
votes1
answer462
viewsSQL SERVER 2008 R2 - TEMPDB ERROR
Good morning, by the way, does anyone know a solution to this mistake : Msg 8921, Level 16, State 1, Line 1 Check terminated. A failure was detected while collecting facts. Possibly tempdb out of…
-
1
votes1
answer679
viewsPHP PDO Microsoft SQL SERVER
Personal I have this class that connects with mysql database, how can I use to connect to microsoft SQL Server ? <?php abstract class database { /* Método construtor do banco de dados */ private…
-
1
votes2
answers1980
viewsGenerate Inserts from a populated table
I have a populated table and I need to generate the scripts of insert of the data stored in it, I cannot export, it has to be the script of insert into ... Do for select concatenating is very…
-
1
votes1
answer610
viewsDrop Inventory with SQL Triggers
I started doing a course on SQL and I’m in doubt about triggers this is the table create table Produto ( codProduto int primary key identity(1,1), Nome varchar(50), Quantidade int, Preco smallmoney…
-
1
votes0
answers371
viewsHow to make a SELECT with CONVERT or CAST in the WHERE clause using sequelize
I need to select below using sequelize. SELECT COUNT(*) AS 'Count' FROM Table WHERE CAST(DatetimeField AS DATE) = CAST(GETDATE() AS DATE) So far I’ve managed to do using between but it’s not the…
-
1
votes0
answers353
viewsHow to join 3 queries of quantities of different records?
I need to unite 3 darlings with different results and quantities of records in a single query, using the Where end of script as Where main for all darlings. How can I do this? I tried with the…