Quantcast
Channel: CodeFari
Browsing all 265 articles
Browse latest View live

Difference between @@CONNECTIONS and @@MAX_CONNECTIONS in SQL Server

@@MAX_CONNECTIONS: it returns maximum number of synchronous user connection allowed. SQL Server allowed by default maximum 32767 connections. To avoid many connections it can be configured at server...

View Article


How to Enable & Disable XP_CMDSHELL using SP_CONFIGURE in SQL Server

In this article we will know how to enable/disable xp_cmdshellusing sp_configure in SQL Server. xp_cmdshell use to import text file to SQL Server.When I tried to import .txt file using xp_cmdshell to...

View Article


Import text file using xp_cmdshell in SQL Server

There are several technique to import file in SQL Server from external source like SSIS, BULK INSERT command, Import/Export wizard, OPENROWSET etc. one of them xp_cmdshell is use to import text file to...

View Article

How to get sizes of all databases files in SQL Server

Using sys.master_files catalog view we can get information of size of database files.For all databases this view contains a row per file of database.We will try to get column database_id which is ID of...

View Article

How to get last access/update date time of a table in SQL Server

Using sys.table catalog view we can access modified and created date. if any structural changes are made the modified date is updated. Following query may help you.USE [Database Name]GOSELECT...

View Article


Ordering SQL query by specific field values in SQL Server

I am doing custom sorting in order by clause in SQL Server. As we know ORDER BY clause use to sort results returned by SELECT statement. If we apply ORDER BY clause on particular column which is...

View Article

How to change schema of table in SQL Server

In SQL Server 2005 and above versions  all tables grouped into schemas. When we creating a table without specify a schema SQL Server creates a default schema "dbo".  We can alter the schema of...

View Article

How to use ROLLUP with GROUP BY clause in SQL Server

As we know GROUP BY clause use to groups the result set into summary. For example pleas execute the following query.I am creating a productSales table which have sales data of product for...

View Article


Image may be NSFW.
Clik here to view.

What is Fill Factor in SQL Server

Fill Factor is working in performance tuning area, for the index the most important property is Fill Factor. Fill Factor responsible to determines the percentage of space on each leaf-level page to be...

View Article


Difference between VARCHAR and NVARCHAR in SQL Server

1.    VARCHAR is Non-Unicode variable length character data type while NVARCHAR Unicode variable length character data type.2.    VARCHAR takes 1 byte per character while NVARCHAR takes 2 byte per...

View Article

$project in MongoDB with example

$project use to reshape the each document for the next pipeline such as adding new field remove existing field.$project stage has following prototype form{ $project: { <specifications> } }The...

View Article

$match (Aggregation) in MongoDB with example

This operator use to filters the documents stream. If specific condition(s) match then it will allow to document to pass next pipeline.Syntax:Aggregate[{$match:{query}}]For Example: I am creating...

View Article

$redact(Aggregation) in MongoDB with example

Using $redact we can restrict the content of document on the basis of information stored in document themselves. For example a collection named Inventory which have following structure.Run following...

View Article


$limit (Aggregation) in MongoDB

This operator use to pass n documents to next pipe line where n is the specified limit.See following example.use Testdb.Inventory.insert({"Title":"MongoDB Tutorial by...

View Article

$skip (Aggregation) in MongoDB

This operator use to skip first to n documents and remaining will be passed in next pipeline. n= skip number.Syntax:{$skip:<positive integer>}See following exampleuse...

View Article


if/else condition in MongoDB

$cond operator has keyword "if", "then" and "else", using this operator we can perform if/else in MongoDb query.See following example:Use Testdb.Users.insert({    "fName" : "Dilip",    "lName" :...

View Article

What is difference between UNION and UNION ALL in SQL Server

We use UNION and UNION ALL operator to combine multiple result set into one result set.UNIONoperator is use to combine multiple result set into one result set but remove any duplicate rows. Basically...

View Article


How to check if a VIEW exist in SQL Server

Many scenario come in query writing, we have to check particular VIEW exists in database or not. There are many approach to check existing view in SQL server, some approach script described below.For...

View Article

Query to fetch records where field is equal to particular value in MongoDB

Problem: Suppose we have to fetch records from a collection which one field is equal to particular value?Solution: We can use $eq operator to fetch records from collection which one field has...

View Article

ReIndexing Database Tables in SQL Server

If we create index on table and indexed table frequently changes occur than fragmentation increases. This may reduce your query performance. So we need to rebuild the index time to time.We can use DBCC...

View Article
Browsing all 265 articles
Browse latest View live