Por padrão a senha do SQL Server segue as mesmas regras do Windows, onde esta deve ser composta por:
Letras maiúsculas e minúsculas;
Caracteres especiais; e
Neste caso, a sua senha deve ser composta por estes elementos, como também, ter um tamanho de no mínimo 8 caracteres, veja este exemplo clássico:
A nicer way of doing this is to use NULLIF like this:
[code type=sql]Percentage = 100 * ClubTotal / NULLIF(AttTotal, 0)
I recently ran to a situation on a development machine where I absolutely needed to use a given password in SQL Server and although the provided password was quite long…and impossible to guess…it was still not considered a strong password due to lack of special characters…so I got prompted with the following error:
“Password validation failed. The password does not meet Windows policy requirements because it is not complex enough. (Microsoft SQL Server, Error: 15118)”
The validation requirement process is not part of SQL Server per se, but rather part of Window’s Local Security Policy.
To fix it I went to “Administrative Tools” and launched “Local Security Policy”.
From there: Security Settings –> Account Policies –> Password Policy
And attempted to disable “Password must meet complexity requirements”…but I wasn’t allowed to modify it as it was locked / grayed out / inactive, and wouldn’t let me change its value, due to a policy enforced through the company’s domain.
I would not recommend modifying these security settings on a production, stage or shared server environments where sensitive data might reside. But this wasn’t the case this time.
There is still a way to disable this setting without going through Domain Administrator, who would not even consider your request anyways.
1) Launch command prompt, as Administrator if possible
2) Type secedit /export /cfg c:\somefolder\local.cfg
3) Launch Notepad. Open local.cfg to edit.
4) Where it says “PasswordComplexity=1”, change 1 to 0.
5) While you are here, you could also set the minimum length requirements lower or higher with the “MinimumPasswordLength” key.
6) Save and Close Notepad.
7) At the command prompt, type “secedit /configure /db %windir%\security\local.sdb /cfg c:\somefolder\local.cfg /areas SECURITYPOLICY
8) Close and re-launch “Local Security Policy” window, or just refresh its values.
9) Done…now you can set your less complex, less secure password!
Written by Ramin Haghighat
I found the following techniques helpful:
Make sure your database engine is configured to accept remote connections:
- Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
- Click on Surface Area Configuration for Services and Connections
- Select the instance that is having a problem > Database Engine > Remote Connections
- Enable local and remote connections
- Restart instance
You may need to create an exception on the firewall for the SQL Server instance and port you are using:
- Start > Run > Firewall.cpl
- Click on exceptions tab
- Add sqlservr.exe (typically located in
C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Bin, check your installs for the actual folder path) and port (default is
- Check your connection string as well
Check if your SQL server services is up and running properly:
- Go to All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server Configuration Manager > SQL Server Services
- Check to make sure SQL Server service status is Running.
In addition, ensure that your remote server is in the same network. Run
sqlcmd -Lto ascertain if your server is included in your network list.
Enable TCP/IP in SQL Server Configuration
When two or more SQL Servers are connected across network they do all communication using TCP/IP. The default port of SQL Server installation is 1433. This port can be changed through SQL Server Configuration Manager. TCP/IP should be enabled for SQL Server to be connected.
- Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP
- Right Click on TCP/IP >> Click on Enable
You must restart SQL Server Services for all the changes to take effect. Right click and go to menu properties to select location where default port of SQL Server can be changed.
RESTORE DATABASE [BANCO] FROM DISK = N’C:\Compartilhamento\banco_backup’ WITH FILE = 1, MOVE N’VMD_DATA’ TO N’E:\SqlServer2016\MSSQL13.SQL2016\MSSQL\DATA\BANCO.mdf’, MOVE N’BANCO_LOG’ TO N’E:\SqlServer2016\MSSQL13.SQL2016\MSSQL\DATA\BANCO.ldf’, NOUNLOAD, STATS = 5, CONTINUE_AFTER_ERROR;
BACKUP DATABASE AdventureWorks2012
TO DISK = ‘Z:\SQLServerBackups\AdvWorksData.bak’
WITH CHECKSUM, CONTINUE_AFTER_ERROR;
|FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases.
Technically speaking, FreeTDS is an open source implementation of the TDS (Tabular Data Stream) protocol used by these databases for their own clients. It supports many different flavors of the protocol and three APIs to access it. Additionally FreeTDS works with other software such as Perl and PHP, providing access from those languages as well.
If you are looking for a Java implementation, we refer you to the jTDS project on SourceForge.
FreeTDS has many possible uses. It has been used by Unix/Linux webservers to present data stored in SQL Server to the web, to port SQL Server database code from NT to Unix, to import data into SQL Server from a Unix source, and to provide database access on platforms (such as realtime systems) that have no native drivers.
The FreeTDS C libraries are available under the terms of the GNU LGPL license. Consult COPYING.LIB in the distribution for details.
File name: config_freetds_linux.sh
sudo apt-get install wget sudo apt-get install build-essential sudo apt-get install libc6-dev wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.27.tar.gz tar -xzf freetds-1.00.27.tar.gz cd freetds-1.00.27 ./configure --prefix=/usr/local --with-tdsver=7.3 make sudo make install
Usando o SQL Server Management Studio
- No Pesquisador de Objetos, conecte-se a uma instância do Mecanismo de Banco de Dados do SQL Servere expanda-a.
- Clique com o botão direito do mouse no banco de dados a ser alterado e clique em Propriedades.
- Na caixa de diálogo Propriedades do Banco de Dados , clique na página Opções .
- Da opção Restringir o Acesso , selecione Simples.
- Se outros usuários estiverem conectados ao banco de dados, uma mensagem Conexões Abertas será exibida. Para alterar a propriedade e fechar todas as outras conexões, clique em Sim.Também é possível definir o banco de dados como acesso múltiplo ou restrito usando esse procedimento. Para obter mais informações sobre as opções de Restringir o Acesso, veja Propriedades de banco de dados (Página Opções).