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
-
4
votes3
answers33401
viewsSelect 1 record of each ID based on the last date
I have a fictitious table TB_META with the fields: COD_VENDEDOR | DAT_ATIVACAO | VAL_META Supposing I have these values in the table: 1 | 2011-01-01 | 1 1 | 2014-04-04 | 2 2 | 2012-01-01 | 3 2 |…
-
4
votes1
answer2749
viewsImport Excel Data to SQL Server
I need to import the data that is in excel into a table in sql. I looked at several websites but nothing has worked so far. Using sql server management studio I have done the following so far,…
-
4
votes1
answer466
viewsCreate Rigger within a Precedent?
I wonder if it is possible to create a Trigger within a Database? (SQL SERVER) The reason is that I drop the table that is with Rigger at the end of the day, and then recreate it with a precedent,…
sql-serverasked 10 years, 3 months ago user3062055 71 -
4
votes1
answer1518
viewsSQL Server Performance Loss with Sequential Insert
I have an . Net C# application that takes data via Web Service and saves it in an SQL Server 2012 database. Initial performance is 20 records per second. After having some 10000 records in the…
-
4
votes1
answer5739
viewsIs it possible to generate a table script from an SQL command?
I would like to generate a table creation script, from an SQL command so I could build a program that was able to clone tables. I am using SQL Server 2008 R2 and need to implement a table cloning…
-
4
votes2
answers96
viewsSearch performance involving multiple disks
Supposing that a query using JOIN between two or more tables, such as: SELECT * FROM foo INNER JOIN bar ON foo.id = bar.id There is performance gain if the table data is in different HD’s (due to…
-
4
votes1
answer3184
viewsHow to know the permissions of a scroll in SQL Server
I am administering some Databases that were created before my arrival. In most of them was created a role called dp_role_analista, and some users are in this role. How do I know what permissions…
-
4
votes2
answers1937
viewsError: "PHP Startup: sqlsrv: Unable to initialize module"
I’m trying to access SQL Server through XAMPP on Windows 7 64 bits, but I’m not getting, I already followed step by step the tutorials, but when starting Apache gives the error in the line below:…
-
4
votes1
answer587
viewsHow to communicate a local application with an open web page in the browser?
I have a commercial web application that runs basic restaurant operations. In summary, a waiter accesses the 'orders' page and requests a new 'product'. These products are classified by departments,…
-
4
votes1
answer743
viewsOUTER APPLY does not work like INNER JOIN
I know that the OUTER APPLY command is analogous to INNER JOIN, but I am confused about a situation where this does not happen. The query below extracted from the Training Kit 70-461: SELECT…
-
4
votes3
answers527
viewsStructure/Nomenclature of Tables
I am developing a permission system and I have a universe of 9 tables, which form the final permission for the user to use my systems, however, I am in doubt of how to build two of them, the…
-
4
votes2
answers736
viewsPDO::rowCount() returning -1
I have this routine below, which used without problems with a Mysql database. However I had to migrate to a SQL Server 2008 database, which was simple. The only problem is, I don’t know why mine…
-
4
votes3
answers1491
viewsAdd field at position I want in sql server
Every time I make one ALTER TABLE and add a column, this field goes to the end. In design mode, using the Sql Management graphical tool, there is the Insert Column option at any position, but it…
-
4
votes1
answer542
viewsInvalid Colum name
SQL Server is giving me the following warning: "Invalid column name", where the column name has nothing else..…
sql-serverasked 9 years, 10 months ago GustavoSevero 2,567 -
4
votes1
answer1320
viewsComposite primary key or primary key plus single index?
I am developing a report in my system to control the productivity of teams, the table of teams has the following information: (tblequipe) | id (pk) | nome | meta | | 1 | EQ01 | 5 | | 2 | EQ02 | 7 |…
sql-serverasked 9 years, 10 months ago mateusalxd 2,768 -
4
votes3
answers12716
viewsSQL Grouping by name, date and quantity by month
I am not able to group this result per month ("PP.PAPELETA_DATA" field). Type the quantity (Count(PD.Personal) as Total) separated by month! Could someone give me a hand? Usage SQL SERVER 2012.…
-
4
votes1
answer5879
viewsRecursive query
I need to mount a recursive query to solve a simple problem, but I’m having a little trouble. I have a table called TABELA1 with the following fields (ID, IDPAI, NOME) I will put here some examples…
-
4
votes2
answers377
viewsAlternative to Exists()
I’m looking for an alternative to using the command Exists in procedures I need to perform a large query and check if it returns any data, if it does not return the search should return a select…
sql-serverasked 9 years, 8 months ago Marciano.Andrade 1,205 -
4
votes3
answers1500
viewsCopy bank record
I used the following query to try to 'copy' a record insert into valores select * from valores where id = 1 However, I receive the following message: An Explicit value for the Identity column in…
-
4
votes1
answer315
viewsSQL Server CHAR and VARCHAR
I understood the difference between CHAR and VARCHAR. If I want to insert in a field VARCHAR(10) the word 'house', that word in the bank will take 4 bytes. If I want to insert in a field CHAR(10)…
-
4
votes3
answers1608
viewsIs it possible to backup a remote bd sql server via c#?
I am using Assembly Microsoft.SqlServer.Management.Smo to back up an Sql Server database to c#. The problem is that the way it is implemented I can only perform the action if I am running the…
-
4
votes1
answer15857
viewsCreate primary key in a table that already exists in sqlserver
I imported a file txt with six million lines for a Sqlserver table. Now I want to create a primary key in it, the problem is that no column guarantees integrity, so I want to create another column…
sql-serverasked 9 years, 6 months ago Ricardo 5,680 -
4
votes3
answers685
viewsDoubt with Getdate()?
I have an SQL query that should bring me only records whose date is longer than the date of the day, but records with the current date are coming. Thanks! --não deveria mostrar a data de hoje select…
-
4
votes1
answer2506
viewsInsert data into a table from a Java form (Netbeans+SQL Server)
I have a form created so that I can enter data about a client and from this form open a table with a button that has the data, so far I have been able to link the buttons. Now my question is how I…
-
4
votes2
answers320
viewsSQL Server - Doubt update and relation between tables
I have two tables, one call coletor, and another call material, have a proc calling for cadMat, that was to register material in the bank and by Cpf (parameter of proc) put as the name of the…
-
4
votes1
answer415
viewsHow to send data from one table to another with the Deleted command
Guys I’m creating this trigger in the SQL Server, but I’m not getting the id to send the data to another table and delete from this table. CREATE TRIGGER MoveComprador ON comprador INSTEAD OF DELETE…
-
4
votes3
answers1334
viewsSQL query in PHP and date format
I have a PHP function that interacts with my SQL Server. It looks like this: public function buscaRelatorioHospedagem($nome,$de,$ate){ // TODO Essa função pode ser aproveitada pra aba nova $de--;…
-
4
votes1
answer119
viewsHow do MVC application authentication with Linux?
I have a project in ASP.Net MVC and I’m putting the authentication manually. Everything is going well, but I used as a reference a ready-made project that uses the Entityframework, but I want to use…
-
4
votes1
answer155
viewsIs Visual Studio 2013 compatible with SQL Server 2014?
I connected the SQL table with Visual Studio, but at the time of moving the table appeared a message saying that SQL Server was not compatible. If not, I’ll have to download another Visual Studio or…
sql-server visual-studio-2013 visual-studio sql-server-2014asked 9 years, 4 months ago Márcio Cristian 399 -
4
votes2
answers703
viewsHow to save multiple users to an account like Netflix for example
Next, I have an application that supports only 1 account per user, I want to update the database on MySQL so that it supports a system that can be saved for example, child accounts, derived from…
-
4
votes1
answer609
viewsInstall SQL Server with the application
I am finishing an application and will compile using Inno Setup. The system is using SQL Server. I’ll install the system on other computers. The database is installed on the computers that will…
-
4
votes1
answer281
viewsSQL Server Full-Text-Search
I am developing a search using the full text search of SQL Server 2008. The search is working correctly, but the need to include a feature appeared. When you search for "Joes", the message "you…
sql-serverasked 9 years, 4 months ago Tiago 1,224 -
4
votes3
answers3464
viewsAverage between 3 direct dates in sqlserver bank?
What is the most efficient way to calculate the average of dates in the same column by the sqlserver database? I need to take the date of the last 3 sales of a customer, and return in days to know…
sql-server sql-server-2012 sql-server-2008 sql-server-2014 sql-server-2005asked 9 years, 4 months ago Laísa Ferreira Cardoso 116 -
4
votes2
answers655
viewsProblem Migrating Mysql Database to SQL Server
I am unable to migrate a database from Mysql to SQL Server using Mysql Workbench Database Migration. In SQL Server authentication, it uses sa login, I tried to reset the password of this login, but…
-
4
votes6
answers17792
viewsAccentuation problem while recovering records in SQL Server
When I recover records from a SQL Serve database with PHP errors appear in accentuation. But in the database, the accents are correct. Is there any way to handle this with PHP? I don’t have…
-
4
votes1
answer618
viewsSQL 2012 - replace (nolock) with(nolock)
I need help solving a mismatch problem. The company I work with is migrating from an SQL Server 2008 database to 2012, but we have identified some problems. The main one is the declaration of…
-
4
votes2
answers132
viewscheck if several fields are created in the database
It was added in a table plus 7 columns, only before you need to check if this column is in the database otherwise the column creation script should not be executed. Is there a way in a single…
-
4
votes1
answer785
viewsError when trying to connect to SQL Server from webservice on IIS 7.5
I am getting some errors when trying to perform a query in SQL Server from a Webservice hosted on an IIS 7.5 server. My connectionString on the web.config: <connectionStrings> <remove…
-
4
votes2
answers81
viewsSimple SQL query
I have a proc that gets a product ID. If it gets NULL, then it should list all products. If it gets the specific ID, it should list only that product. There is some way to do this without having to…
-
4
votes1
answer1604
viewsSee Date only, in a Datetime field with LINQ
I’m generating a report in an app that I’m developing, but I have a little problem. When sending a query in a date interval, I can’t get anything, because it is a DATETIME (I can’t change to date…
-
4
votes1
answer3554
viewsDifference between SQL Server Express versions?
What’s the difference between SQL Server Express versions of Dreamspark?…
-
4
votes1
answer580
viewsError connecting php 5.5 to SQL Server
I can’t make a simple Conn work between sql server and php!! I already downloaded and left in the ext folder the drivers according to my version of php I already referenced them in php.ini restarted…
-
4
votes1
answer4693
viewsThere is a way to know the name of the Database Server
There is an sql command that can inform the server and the database in which select is running? I am available for more details
-
4
votes5
answers19374
viewsHow to check if a field of type text or ntext is null or empty?
How can I check whether a field of the type ntext is null or empty in where? I got the following select SELECT Subject, Notes from DocumentNotes where Notes is null or Notes = ' ' but when comparing…
-
4
votes2
answers1652
viewsSQL Server: how to create range of values based on a column with monetary values
Hello, community! I need an SQL query with the values of a SQL Server 2012 table field shown as frequency distribution. Let’s say I have, today, the field Sales (in R$), type float. The lowest sales…
-
4
votes1
answer1002
viewsConnect to SQL Server on remote server
I need to connect to an SQL Server service on a remote server via Sqlconnection, C#. Initially, it was not possible to find the server, but I solved this by modifying the hosts file of system32,…
-
4
votes1
answer4458
viewsHow to return day of the week and time formatted sql server 2008?
I need to make a query as follows, I have a table (script): 1 - Take the day of the week 2 - take server time in format hh:mm example: SELECT CASE DATEPART(DW, GETDATE()) WHEN 1 THEN 'DOMINGO' WHEN…
-
4
votes3
answers3103
viewsHow to perform UPDATE with ORDER BY on sql server?
I would like to perform an update ordering the results of the same, for this I wanted to run an update like this: UPDATE pessoa SET nome = 'Jose' WHERE sobrenome LIKE '%Betalla%' ORDER BY nome But…
-
4
votes1
answer3164
viewsError "There is already an Object named '#TEMP' in the database"
I’m performing a load, using a temporary table on Microsoft SQL Server 2008. SELECT CAMPO1, CAMPO2, CAMPO3, CAMPO4 INTO #TEMP FROM DADOS In the query, I use the following command, to check if the…
sql-serverasked 8 years, 10 months ago WASBOARD 77 -
4
votes0
answers177
viewsHow to monitor the progress of a VB.NET INSERT query?
I’m storing files in a database SQL server using a varbinary(max) field. I wonder if it is possible to detect the progress of the file upload (in which case it would be a INSERT in the table) using…