web stats analysis

SQL Server Archive

What is the maximum character for the nvarchar maximum in sql server?

Below little description about it.

The maximum size for a column of type NVARCHAR(MAX) is 2 GByte of storage.NVARCHAR use per character 2 bytes, that’s approx. 1 billion characters.

The process cannot access the file ‘.mdf’ because it is being used by another process

Solution of:The process cannot access the file ‘.mdf’ because it is being used by another process

Follow below solution:

If you are work in SQL server.

Close your SQL server,
Reopen your SQL server.

If you are work in asp.net.

Close your asp.net,
Reopen your asp.net.

Your problem has been solve:

How to convert text to integer in SQL?

In SQL, How to convert text to integer?

I have a Solution Is Like Below.

Using below function you can convert:

Using CAST or CONVERT function you can convert.

Syntex of CAST or CONVERT function.

Syntax for CAST:
CAST ( expression AS data_type [ (length ) ])
Syntax for CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

Example

Use of CAST function to convert table column value in
select clause:

SELECT ProductName, UnitPrice, CAST(UnitPrice AS INT) AS AroundPrice
FROM Products

Output

ProductName UnitPrice AroundPrice
Konbu 6.00 6
Tofu 23.25 23
Genen Shouyu 15.50 16

Above example returns converted unitprice in an integer value named as AroundPrice of table products.

How to set default page for my website?

Which way to set default page for my website?

How to add default page for my website?

I have a Solution Is Like Below.

Follow the below steps:.

Step1. Please login to the cPanel

Step2. Select the file manager and click on it

Step3. After one small popwindow will open and there is check box with
massage Show Hidden File And Folder

Step4. Please click on check Box.

Step5. After opening the File Manage Click on the public_html folder

Step6. Select the .htaccess file and click for opening in Code Editor

Hope,after follow above steps your page has been set in your website.

For more details Click here..

Find records from one table which doesn’t exist in another in SQL.

Here I make a two tables.it’s following.

Information:

ID NAME ADDRESS
1 aaa Palanpur
2 bbb Deesa

Information_book

ID NAME ADDRESS
1 aaa Palanpur
2 bbb Deesa
3 ccc Ahmedabad
Now,you want to find out the record in information_book table
but this record doesn’t exist in the information table.

This time you fire following query…

This query is easily find the record and easy to understand.

Query:-
SELECT * FROM information_book WHERE
address NOT IN (SELECT address FROM information_book);

You want to find alternet record So,fire this query.

Query:-
SELECT * FROM information_book WHERE NOT EXISTS

(SELECT * FROM information WHERE information.address = information.address)

Your output is bellow.

Information_book

ID NAME ADDRESS
3 ccc Ahmedabad

Sql query for insert Gujarati data

How to insert Gujarati data in sql database

Insert Gujarati data in sql database

See Following insert query
insert tbl_Employee(Name) values(N’એબીસી’)
Note : You want add Gujarati text in table so you must enter N before your Gujarati text

Sql query for change datatype of a column

How to change the data type of a column with query?

Change the data type of a column with query?

Changing the datatype of a Column

SQL Query to modify a column datatype lenght

Solution

ALTER TABLE table_name
ALTER COLUMN column_name datatype

Example 

ALTER TABLE tbl_customer
ALTER COLUMN First_Name nvarchar(50)

 

How to solve the problem orphan users in SQL Server databases?

First you need to know what is orphaned user?
SQL Server maintains user logins in the sysxlogins system table in the master database. Every time you add a user, or give a Windows account access, an entry is made in this table. Every user is assigned a security identifier (SID) in sysxusers. Each database has a table called sysusers that contains a list of users that have access to that database. Typically, the SID in the sysusers table matched the SID in sysxusers.
When a user entry exists in sysusers that that does not have a matching SID in sysxusers, that user is “orphaned.

Read the rest of this entry »

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.SQLEditors)

ADDITIONAL INFORMATION:
The SELECT permission was denied on the object ‘database_principals’, database ‘mssqlsystemresource’, schema ‘sys’. (Microsoft SQL Server, Error: 229)

If you are facing the above error then you should check the following steps.

Step1 : If your hosting at the shared server then check your account has suspended or not
If suspended then you can unsuspend the account it will start working and you are not
viewing this error again. (Make the request mail or call to your hosting provider to unsuspenssion)

Read the rest of this entry »

How to print the names and owners of all the tables in the sql server database

print the names and owners of all the tables in the sql server database

Solution

EXEC sp_MSforeachtable @command1 = “PRINT ’?’”