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
answer13959
viewsSet default value for column of an existing table
It is possible to set default value for column of an existing table? I am trying this way, but always the column is null instead of the default value that was reported. IF NOT EXISTS (SELECT * FROM…
sql-serverasked 9 years, 4 months ago krispim 453 -
1
votes1
answer2143
viewsDatabase modeling helps you!
I need to make a library system for book loans, in which I drew up this database diagram. The professor said that this diagram is inconsistent. What needs to be done, it’s just these tables that I’m…
-
1
votes1
answer36
viewsDoubt with time recording data in master-detail tables?
After entering a record, I use the select max(IDControle) to recover table id to record items. When the time is only 1 second, I noticed that the items were all recorded in the first record. Does…
-
1
votes1
answer281
viewsStarting SQL Server 2008 express R2
Guys, I have a problem: I formatted my computer and I can’t start SQL Server 2008 Express R2. When I click on the icon to initialize the following message appears: Microsoft SQL Server Management…
-
1
votes0
answers204
viewsHow to delete duplicate records in a Sqlserver table
I have a table where I need to apply a new watering, column A + B cannot have the same value. I intend to add a rule like that: ALTER TABLE minhatabela ADD CONSTRAINT minhaconstraintnome UNIQUE…
-
1
votes0
answers40
viewsOracle10g integration with Sql Server 2008 via JDBC
I need some help, I have a system that integrates Oracle with Sql Server, that worked perfectly but Sql Server was 2000, it was upgraded to Sql Server 2008, it used the jdbc 2000 driver, now I…
-
1
votes0
answers95
viewsSee which user created or changed a Linked server
Sirs, How to audit the creation or modification of Linked Servers in SQL Server 2008 or higher? (See who created or changed a Linked server).
-
1
votes1
answer167
viewsDeploy Windowsforms with bank . mdf
I made a program in Windows Forms (C#) in layers. Model DAO BLL Interface Create a Database (Generator.mdf) in the Model Project and its Context (edmx). Now I want to publish, and how do I get the…
-
1
votes0
answers467
viewsC# Desktop System Integration with ASP . NET WEB System
I have a C# Desktop System and the data is recorded in Sqlserver. How can I write this data simultaneously to a WEB system developed in ASP . NET ?
-
1
votes1
answer233
viewsDoubts about the datagridview
Hello I have some questions about the datagridview of visual studio, I would like to know how I can change the values of the columns that appear to Foreign key of sql server by the value of the…
-
1
votes1
answer207
viewsGet the parent by passing the child code using Hierarchical Data (SQL Server)
How do I get EmployeeID of the father passing the EmployeeID of the child in the table below using the type variable hierarchyid in SQL Server? CREATE TABLE Employee ( Node hierarchyid PRIMARY KEY…
-
1
votes1
answer1121
viewsShow only one record of each ID
I have a table Clientes and a ClientesTel. I need to present a list where the Código do Cliente, Nome, Telefone e o email, but by the structure I can have several phones. Follow the SQL I’m trying…
-
1
votes1
answer64
viewsAutomated Deploy - Multi-customer version maintenance
How best to automate deploy ? Having 1 deploy for each client, what is the easiest way to maintain all these deploys ? Database Migrations and all version processing? In an example you have 100…
-
1
votes2
answers619
viewsHow to get data from two tables in the same column?
I have two tables in the database: Tabela1 Id Nome Sexo 1 NomeA Macho 2 NomeC Fêmea Tabela2 Id Nome Sexo 1 NomeB Macho 2 NomeD Fêmea I would like to have the following result: Id Nome Sexo Tabela 1…
-
1
votes0
answers108
viewsProblem with aggregation function, using Hibernate Createquery
In a Package, a fkEmbaling refers to the 'father', the larger package. EX: Let’s say that 10 A packs fit inside a B package. A packaging record A will have in its fkEmballing the packaging B in…
-
1
votes1
answer1654
viewsRDS AMAZON - Difficulties to connect in Database
I created a database instance Sql server on Amazon, however I cannot connect to Sql Server Management Studio. I get the message: error 10060 Unable to connect to endpoint address,1433. I am using…
-
1
votes1
answer2043
viewsWhat is the difference between OUTER APPLY and INNER JOIN in Sql Server?
What’s the difference between OUTER APPLY and INNER JOIN in the Sql Server? I know how the LEFT/RIGHT/INNER JOIN works but I came across the OUTER APPLY I read it but I didn’t fully understand it,…
-
1
votes0
answers476
viewsCollation does not recognize accentuation
Ttenho 2 banks in Sqlserver, bank A with the collation SQL_Latin1_General_CP850_CI_AS and another bank called B with the collation Latin1_General_CI_AS. At bank A imports information to bank B. A…
-
1
votes1
answer217
viewsAES128/256 C#. net AND SQL 2008/2012 encryption
Greetings, Does anyone know of any AES compliant encryption implementation between c# and SQL? I want to encrypt in C# and decrypt in SQL.
-
1
votes0
answers91
viewsSQL Server: error 7303 (Architecture Mismatch)
I’ve done a lot of research, but I haven’t found a solution for my case yet. I need to create a Linked server for an Access database (mdb file). Use SQL Server 2012 Express x64 in Windows 8.1 x64. I…
-
1
votes2
answers457
viewsAutomated backup in SQL Server Express
In my current scenario I have a service of Windows which rotates in the background which at a specified time by me rotates a batch that makes the backup and saved in the Dropbox. But what happens is…
-
1
votes0
answers73
viewsMSSQL - make select form in the result the fields do not appear repeated
The select I’m making is this: SELECT DISTINCT dbo.Entity.ComercialName ,dbo.ScheduleStatus.Description ,dbo.ScheduleGoal.Description AS alias_DSG ,dbo.ScheduleType.Description AS alias_DST…
-
1
votes1
answer394
viewsDate format in PHP from SQL server
I am running the following code: $sql= mssql_query("select getdate()"); $res = mssql_fetch_assoc($sql); and he’s returning me the following date: 2015-04-10 32767:06 The time is five digits, someone…
-
1
votes2
answers685
viewsSchema permission in specific user
I created a standard database and created some schemas within this database. I created users for each schema, now I want to give full permission for each user in their schema only, as I should do?…
-
1
votes1
answer1546
viewsSQL query grouping by age group
Hello, I need a way to make an sql query that brings me the amount of male and female people. OBS: I have two tables where the first one is registered in it I have the sex column and another table…
-
1
votes1
answer782
viewsOrder by SQL Server under Procedure
Hello, I have the following situation: I need to select the amount of care of people of some age groups and of those who are male and female. I have the following tables: cadastro (id, natendimento,…
-
1
votes1
answer101
viewsProcedure sql server, return the total value of an id
I have a bank of products sold forming by id, name and value. I would like to make a trial that returns total of each product that was sold. Algem knows how to do this? Let the result follow Mouse =…
sql-serverasked 9 years, 1 month ago Eduardo F. Santos 449 -
1
votes2
answers277
viewsFormat select output
I have a problem to format a column in gridview, this column takes three values from the concatenated database, utlimo value can be null, if null has with not present the last trace that separates…
-
1
votes1
answer1949
viewsRelationship intermediate table n for n
I have two tables with relation N to N in my database, with this, I must create an intermediate table that has the PK of each of these two tables. My doubt is: how to insert data referencing the Pks…
-
1
votes2
answers412
viewsProblems to convert data mon dd yyyy hh:mm
I made a select in SQLSERVER inside php: mssql_query(SELECT TOP 1 ven.DATA FROM tab_venda ven (nolock) INNER JOIN dbo.tab_item_venda iven (nolock) ON iven.num_Venda = ven.NUM_VENDA INNER JOIN…
-
1
votes2
answers54
viewshierarchyid, remove children from one node and assign to another node
I have a user table, with the use of hierarchyid, I need to remove all Subordinate Users from User 1 and assign them to User 2. SELECT US.cd_usuario ,(SELECT cd_usuario FROM USUARIO USR WHERE…
-
1
votes1
answer57
viewsQuery Question - Group Data
I have a question about how to group the data as follows. I have a table called ALUNO_LEGADO, as below: I need to put together a query to get all the students who failed every subject enrolled in a…
-
1
votes2
answers106
viewsError changing static property value
I have my class DadosConexao, this class is responsible for storing the connection string of the database, it contains the following properties: A statistical property StringConexao. isServ…
-
1
votes2
answers166
viewsDouble insertion with mssql_query
I am having a small problem and would like help to solve it. I have a code that makes the insertion into a SQL SERVER database through php. Everything is fine, except that two "INSERT" in the bank…
-
1
votes2
answers763
viewsWhat is the best way to read a sql server error return?
How best to read an error return from sql server in a C# web form application? I got the following.. No sql server; END TRY BEGIN CATCH Raiserror('Erro ao gerar os dados', 18, 1); return; END CATCH;…
-
1
votes1
answer59
viewsCombobox does not return Sqlserver columns
In the following code, it should present me the columns of a table I have on my system, but when clicking to display the options in the combobox nothing appears. However if I start typing the name…
-
1
votes0
answers167
viewsConnection database sql server 2008 PDO
I’m using the following code: try { $con = new PDO("sqlsrv:Server=ip;Database=nome","nome","12345"); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die…
-
1
votes1
answer39
viewsSQL server 2012, ex fix
check if the answer of the exercise below is correct: List the names of customers (Cli_Nome) that have NO NULL BONUS and bought products with code (pro_codigo) greater than 5 and less than 10.…
-
1
votes1
answer395
viewsTo delimit a txt file, that is, the line size should be 700 characters for all subsequent lines
I created a routine that reads some tables and generates lines as read. It’s all right at first. but the generated txt exceeds the size of the fields, for example, a field has size 10 and another…
-
1
votes1
answer633
viewsHow to JOIN where the identifier could not be associated
I have the following query ready on an old system: SELECT regional, r.cod_gerente AS cod_gerente, u2.username AS nome_gerente, s.COD_REPRESENTANTE AS cod_representante, u1.username AS…
-
1
votes1
answer2771
viewsHow to add a default Constraint to an already created column in SQL Server?
In SQL Server, assuming the column already exists, how to create a new DEFAULT Filter? I looked in various references and in all the examples, always had the column to create together. I found the…
sql-serverasked 8 years, 10 months ago Andre Mesquita 1,114 -
1
votes1
answer961
viewsmicrosoft sql server connection and configuration in php
I’m trying to connect to a microsoft sql server database using php. The php version is: PHP Version 5.6.3 and the error that gives is Fatal error: Call to Undefined Function mssql_connect() in C:…
-
1
votes5
answers100
viewsCopy a word from a column to the end
I have several records in sql for example almedia,jose costa santos and I want to change the value to: jose costa santos almeida In other words, I want to take the last name at the beginning (before…
-
1
votes0
answers402
viewsPick up records on Datagridview and play on a label
Guys, my idea is this, I want to pick up records on a Datagridview and play on five Abels. Each one corresponds to a command, and these boxes will change to another record once clicked. Example:…
-
1
votes1
answer404
viewsHow to merge lines?
How can I merge two or more **Linhas x Coluna** of the consultation below? select cast(OS.CreateDate as date) as DtMovimentacao, OS.Id as NrOS, OS.Description Origem, OSI.Description as ItemSaida,…
-
1
votes2
answers1560
viewsCheck that SQL Server is installed C#
I’m finishing a C# application that contains a database in SQL Server. How do I know if the user has the SQL Server 2012 Express Local DB installed? It is possible to check via registry in x86 and…
-
1
votes1
answer2049
viewsHow to do INSERT in three tables with Stored Procedure?
I need to perform a Insert in three related tables in the same query. I have the following scenario: Cidade, Estado e Pais How can I build a stored Procedure in Sql Server for this?…
-
1
votes5
answers7513
viewsReduce Log File Size
I’m in a saga with my database, today I have an 11GB mdf file and a 77GB log. I have already searched in several forums, applied some reduction procedures via Management (Shrink) and via command…
-
1
votes1
answer441
viewsDecimal value with 5 decimal places in sql server
I’m developing an application (Asp.NET MVC 5.2.3.0, EF 6.1.3 e SQL Server 2012), the database has a table with the field decimal(6, 5), when I save a value in this field -2,56478 for example in the…
-
1
votes1
answer8462
viewsHow to configure an existing field for auto-increment?
I would like to define the field id already created as auto-increment, because I created the table and did not put this option to it, how could I do this?