Showing posts with label sql server. Show all posts
Showing posts with label sql server. Show all posts

Friday, August 26, 2011

How to Know the Number of Days in a Month in T-SQL

Sometimes we may need to know the number of days in a given month. For example, in calculating the number of days in a month or last day of the month or any other scenario.

Here is a small script that will give you the number of days for a month. For example, I'll pick month from the current date.

declare @numberOfDaysInMonth int;

set @numberOfDaysInMonth = DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1);

Read more...

Sunday, February 20, 2011

Updates to SQL Server SecuritySeparating schemas and users :

Microsoft has a whole new approach to security. In their own words: "We will reconsider our approach to security We will examine our code of vulnerabilities, we will release patches if necessary, we will disable most features by default to keep the low profile, if you need some ,.... thing turn it on. But if you do not need it, leave it sealed. This way, if vulnerability is discovered in a product that you do not, you will not be affected. "

Latest SQL servers have come with many additional security features of these features not only the database more secure, but also more comprehensible and easier to administer. Database applications can be developed by programmers, while operating privileges exact requirements, with new features added. This feature is called "principle of least privilege." A programmer is no longer necessary to function as an SA (system administrator) or DBA (Database Administrator).

Some key features have been added in the latest server version is:

Security for.NET

Combination of different SQL Server permissions. NET code security and privileges of Windows can be managed and run code the.NET. 3 different levels are used to decide which code can or cannot do outside and the inside of SQL Server.

The Password policies for the users of SQL Server : If you run SQL Server on a Windows 2003 Server and users are allowed to go through similar policies for integrated safety users.

To Map a SQL Server user to Windows credentials: Users of SQL Server have permission to use the Windows credentials when accessing external resources such as network shares and files.

Separating schemas and users : Schemas in SQL Server refer to the first-class objects that can be owned by a user, group, application roles or function. The fact that the definition of synonyms is allowed be it much easier to manage

Permissions grant : No need to login or users with certain roles to certain rights, are all granite table with the revocation to prohibit the grant, and verbs

Fresh security on the Server's metadata : You can not directly update the new metadata views, and only if a user has permissions to some metadata about individual objects, cannot list them.

Support of encryption keys and certificates : The latest security features allows the server to manage encryption keys and certificates, for use with Web Services SSL, with Service Broker, for new data encryption, and with code authentication.

The above are some of the many new security features in SQL join. But it will help give an idea of how Microsoft has tried to work hard to fix any shortcomings in earlier versions of SQL Server and how they did it much more secure than previous versions of this server.


Read more...

Friday, September 3, 2010

How to enable Sql server Authenticaton in Sql server

Usually, when you install SQL Server, select the option to use Windows Authentication mode to connect to SQL Server. But for some scenarios we need for a user authentication to access SQL Server databases. How to change? Here are the steps to enable SQL Server Authentication to SQL Server.
1 Log in to SQL Server using Windows authentication.
2. Right click on the server (name of your SQL server), select Properties.
3. In section, select a page, select Security and Authentication section select the
radio buttonserver SQL Server and Windows Authentication mode, and click OK.
4. After the changes saved, then go to security - users - add a user for SQL
authentication.
5. He needs to reboot the server to reflect the changes.
Read more...