SELECT RIGHT('000000' + CAST(ABS(CHECKSUM(NEWID())) % 9999999999 AS varchar(10)), 10)
This blog is only for C# Windows Aplication & Web Application & Other feature is css & jquery & Sql store procedure
Showing posts with label sql server. Show all posts
Showing posts with label sql server. Show all posts
Sunday, January 14, 2018
Monday, January 1, 2018
SQL DROP TABLE Statement
Here is query for how to drop table in sql server
Replace your table name with tblTest
DROP TABLE tblTest
Replace your table name with tblTest
Friday, December 29, 2017
How to create Roman Numerals function in SQL
CREATE Function [dbo].[GetRomanNo] ( @N as varchar(20) ) RETURNS VARCHAR(100) AS BEGIN DECLARE @s varchar(100), @r varchar(100), @i bigint, @p int, @d bigint SET @s = '' SET @r = 'IVXLCDM' -- Roman Symbols /* There is no roman symbol for 0, but I don't want to return an empty string */ IF @n=0 SET @s = '0' ELSE BEGIN SELECT @p = 1, @i = ABS(@n) WHILE(@p<=5) BEGIN SET @d = @i % 10 SET @i = @i / 10 SELECT @s = (CASE WHEN @d IN (0,1,2,3) THEN Replicate(SubString(@r,@p,1),@d) + @s WHEN @d IN (4) THEN SubString(@r,@p,2) + @s WHEN @d IN (5,6,7,8) THEN SubString(@r,@p+1,1) + Replicate(SubString(@r,@p,1),@d-5) + @s WHEN @d IN (9) THEN SubString(@r,@p,1) + SubString(@r,@p+2,1) + @s END) SET @p = @p + 2 END SET @s = Replicate('M',@i) + @s IF @n < 0 SET @s = '-' + @s END RETURN @s END
Result
Saturday, December 23, 2017
Thursday, December 21, 2017
How to change Schema Name in SQL
Below Query for change you table schema name from eg. dbo. to test.
ALTER SCHEMA YourSchemaName TRANSFER dbo.YourTableName
-- it will change your schema name from "dbo" to "YourSchemaName"
-- it will change your schema name from "dbo" to "YourSchemaName"
Saturday, December 9, 2017
How to get SQL database connection string in 5 simple steps
Step 1 : First Open Server Explorer in your Visual Studio IDE
Step 2 : Now click on + button for open connection dialog
Step 3 : now paste your Server Name for get database list
Step 4 : when you paste your server name 1 Dropdown list is open for select database now select your database
Step 5 : now click on Advance button and get your connection string
Happy developing....
Step 2 : Now click on + button for open connection dialog
Step 3 : now paste your Server Name for get database list
Step 4 : when you paste your server name 1 Dropdown list is open for select database now select your database
Step 5 : now click on Advance button and get your connection string
Happy developing....
SQL Datatype
SQL DataType
1. BigInt
From C# side it stores Int64 Value
MaxValue = 9223372036854775807
MinValue = -9223372036854775808
2. Bit
C# : Store Bool Value Like True or False
3. DateTime
C# : Store Date Time
4. Float
C# : Store Float Value
MaxValue = 3.40282e+038f
MinValue = -3.40282e+038f
5. Int
C# : Store Int32 Value
MaxValue = 2147483647
MinValue = -2147483648
6. Numeric(18,0)
SQL store value like 18 digits with 2 or more decimal place
e.g. 12.00
7. Nvarchar(50)
SQL store Text & unique code value with limited size
8. Nvarchar(MAX)
SQL store Text & unique code value no limit for store data
9. Varchar(50)
SQL store only text Varchar datatype do not support unique code value
10. Varchar(MAX)
SQL store only text Varchar datatype do not support unique code value
11. Uniqueidentifier
SQL store Numeric, Characters, and - with the lenth of 36 characters
Uniqueidentifier do not repeat it generate unique value every time
C# : store GUID value
How to Install SQL Sever 2008 R2?
How to Install SQL Sever 2008 R2?
=> Sql Server Installation Step Follow Bellow : -
1) First of all download sql server management studio 2008 then click setup see image
2) Second step display installation dialog box see image
3) Third step display SQL Server Installation Center Then select "New Installation or add features to an existing installation" Text click see image
4) Then display setup support rules dialog box see image
5) This step is display license terms then by default two checkbox is unselected display see image
6) This step is select two checkbox then enable next button see image
7) This step is display feature selection then click next button see image
8) This step is display error reporting dialog then click next button see image
9) This step is display complete installation see image
10) This step is display your setup is ready to user create new database see image
How to setup in visual studio 2013,2017 ?
How to setup in visual studio 2013,2017
This article is explain how to setup in visual studio 2013.First of all download visual studio 2013 setup then follow step below.
1) First of all setup double click
2) Then open visual studio 2013 dialog box then click continue button show below image.
3) Third step is by default path is set "C:\Program Files\Microsoft Visual Studio 12.0". it can change path and set new path otherwise default path store all file and setup data.
Third step display "I Agree to the License Terms and Privacy Policy"
Checkbox by default un-selected display then select checkbox to display Next button.see image
4) Then Click Next Button see Image.
5) Fifth step display "Optional features to install" by default all selected. then click Install Button.See image
6) Six step is display progress bar in i think 40 minute process to install visual studio 2013 data.waiting in 40 minutes see image
7) Congratulation your setup is completed install and display dialog see image
8) Then click "LAUNCH" text
9) Nine step to display "Welcome Sign in to Visual Studio." then click "Not now,Maybe later " text.see image
10) This step is choose your color theme.there are three theme display
- Blue
- Dark
- Light
11) This step is display waiting few minute see image
12) Finally all process is finish display visual studio 2013 dialog.your are create own web application,Software etc.see image
Thursday, November 16, 2017
format SQL Result in XML {SQL 2017}
Query For Create JSON from SQL
- SELECT * FROM {YourTable} FOR XML PATH
- Just Add FOR XML PATH at the end of your query
- SELECT * FROM {YourTable} FOR XML PATH
- Just Add FOR XML PATH at the end of your query
format SQL Result in JSON {SQL 2017}
Query For Create JSON from SQL
- SELECT * FROM {YourTable} FOR JSON PATH
- Just Add FOR JSON PATH at the end of your query
- SELECT * FROM {YourTable} FOR JSON PATH
- Just Add FOR JSON PATH at the end of your query
Saturday, May 16, 2015
Tuesday, March 24, 2015
How To Update One DataBase Table To Another DataBase Table In SQL
USE db1
go
UPDATE t1 SET DateOfRegistration = t2.DateOfRegistration
FROM db1.TableName1 t1
JOIN db2.TableName2 t2
ON t1.IDP = t2.IDP
go
UPDATE t1 SET DateOfRegistration = t2.DateOfRegistration
FROM db1.TableName1 t1
JOIN db2.TableName2 t2
ON t1.IDP = t2.IDP
How To Copy One DataBase Table To Another DataBase Table In SQL
SELECT * INTO dbStudent.dbo.tblSetting
FROM dbLive.dbo.tblSetting
Labels:
SQL
,
sql course
,
sql server
How To Search Text In Store Procedure SQL
SELECT R.SPECIFIC_NAME,R.ROUTINE_DEFINITION FROM
dbstud.INFORMATION_SCHEMA.ROUTINES R
WHERE UPPER(R.ROUTINE_DEFINITION) LIKE '%' + UPPER('DELETE') + '%'
dbstud.INFORMATION_SCHEMA.ROUTINES R
WHERE UPPER(R.ROUTINE_DEFINITION) LIKE '%' + UPPER('DELETE') + '%'
Labels:
SQL
,
sql course
,
sql server
How To Search SQL Table Use In Store Procedure
SELECT O.NAME FROM SYSCOMMENTS C
INNER JOIN SYSOBJECTS O ON C.ID = O.ID
WHERE TEXT LIKE '%TableName%'
INNER JOIN SYSOBJECTS O ON C.ID = O.ID
WHERE TEXT LIKE '%TableName%'
Labels:
SQL
,
sql course
,
sql server
How Search Text In SQL Storeprocedure
SELECT * FROM INFORMATION_SCHEMA.ROUTINES
WHERE OBJECTPROPERTY(OBJECT_ID(SPECIFIC_NAME),'IsMSShipped') =0
AND OBJECT_DEFINITION(OBJECT_ID(SPECIFIC_NAME)) like '%Procedure Name%'
AND ROUTINE_TYPE='PROCEDURE'
WHERE OBJECTPROPERTY(OBJECT_ID(SPECIFIC_NAME),'IsMSShipped') =0
AND OBJECT_DEFINITION(OBJECT_ID(SPECIFIC_NAME)) like '%Procedure Name%'
AND ROUTINE_TYPE='PROCEDURE'
Labels:
SQL
,
sql course
,
sql server
Friday, July 12, 2013
How to Backup & Restore SQL Database - Query
BACKUP DATABASE dbTest TO DISK = 'C:\Test.BAK'
GO
RESTORE DATABASE dbTest FROM DISK = 'C:\Test.BAK'
GO
GO
RESTORE DATABASE dbTest FROM DISK = 'C:\Test.BAK'
GO
Labels:
SQL
,
sql course
,
sql server
Monday, June 10, 2013
How Find Column Name Use in Which Table Using SQL
select so.name
from sysobjects so inner join syscolumns sc
ON so.id = sc.id where sc.name = 'Name'
Result :
tblStudent
tblEtc
from sysobjects so inner join syscolumns sc
ON so.id = sc.id where sc.name = 'Name'
Result :
tblStudent
tblEtc
Labels:
SQL
,
sql course
,
sql server
Subscribe to:
Posts
(
Atom
)





























