Skip to main content

Posts

Showing posts with the label MS SQL

How to get the Current SQL Server Date and Time ?

How to retrieve the Local Date and Time in sql server ? A common task in SQL Server is the retrieval of the local date and time from the server. Usually, it is more appropriate for a database-linked application to obtain the time from the server than from the local machine, as this ensures that all users are using the same basis for the time. If a user's local clock is set incorrectly, the use of the server's clock ensures that an invalid date or time is not stored. Using the CURRENT_TIMESTAMP SQL Server defines a value named CURRENT_TIMESTAMP. This value can be included in aquery using a select statement or can be assigned to a DateTime variable to obtain the current local time. To demonstrate, try the following statements using a SQL Server Management Studio query window. The first will output the local time to the results window, the second will hold the time in a variable before printing the variable's value in the messages window. NB: When the current date

What is meant by Database Schema in MS SQL

Ever since SQL Server 2005 was released, each object in a database has belonged to a database schema. SQL Server 2008 has continued with database schemas, and an explanation follows. What is a Database Schema? A database schema is a way to logically group objects such as tables, views, stored procedures etc. Think of a schema as a container of objects. You can assign a user login permissions to a single schema so that the user can only access the objects they are authorized to access. Schemas can be created and altered in a database, and users can be granted access to a schema. A schema can be owned by any user, and schema ownership is transferable. Creating a Database Schema To create a database schema in SQL Server 2008: Navigate to  Security > Schemas Right click on  Schemas  and select  New Schema... . Like this: Complete the details in the  General  tab for the new schema. In this example, the schema name is "person" and the schema owner is "Homer

Step by Step installation Guide for MS SQL Server 2008 R2 on Windows server

How to install SQL Server 2008 R2 ? Applies to: SQL Server 2008 R2 November CTP. An evaluation copy of SQL Server 2008 R2 can be downloaded from  here . If you are upgrading to SQL Server 2008 R2, consider these resources and recommendations: Read about supported upgrade scenarios  here . Download and run SQL Server Upgrade Advisor. Upgrade to the same language version as the existing instance of SQL Server. The following are some recommendations before installing SQL Server 2008 R2: Use NTFS file system. Do no try to install SQL Server 2008 R2 on a compressed drive, because setup will block the installation. Do not install SQL Server on a Domain Controller. Click  here  for more information. Configure your firewall to allow SQL Server access. Click  here  for more information about protocols and port numbers. The user account that is running SQL Server Setup must have administrative privileges on the computer. Verify Windows Management Instrumentation service (C