|
|
-
|
|
Today my friend asked me that ISNUMERIC function is not working properly. I checked, the issue was with some special char, might be MSSQL will improve this functionality in coming versions. For now, if we change the way of calling, it will show you the correct result.
These conditions shows wro......
|
|
-
|
|
Today one of my friend ask me, can we use Order by clause dynamically ? I said yes, but there are few limitations while using case in order by clause see the below example.
This script will return Error:DECLARE @TOP INT = 10, @FLD VARCHAR(20)='AGENT_ID'SELECT TOP(@TOP) *FROM( SELECT 1 A......
|
|
-
|
|
Cross tab result is always required and it is bit complex in case of dynamic column.
If column name has to be dynamic then this is the good idea to have the PIVOT Query,
for example I have 3 Tables and data like this:
First Table
------------------------------------------......
|
|
-
|
|
We can use this script to show the row data in string.
Name
------
RAM
SHYAM
HARI
RITA
Name
RAM,SHYAM,HARI,RITA
--Use the following query
DECLARE @strList varchar(100)
SELECT @strList = COALESCE(@strList + ', ', '') +
CAST(Name AS varchar(5))
FROM TABLE1
SELECT ......
|
|
-
|
|
specify size and press OK3) Now see your log and file size.
SELECT name AS [FName] , file_id, physical_name AS [Phy.Name],
size/128 AS [SizeInMB],
size/128.0 - CAST(FILEPROPERTY(name, 'Used'......
|
|
-
|
|
We can backup a SQL Server database to a mapped drive using the following script
1) First it will create Map Drive in Local PC2) Backup the Database.3) Delete the Map Drive, so that next time the same script can be used.
EXEC master..xp_cmdshell 'net use z: "\\192.168.1.93\share" password /user:......
|
|
-
|
|
Few days back I was trying to send sql data to my web API using Store-procedure and it was simple and interesting, you can use the same way to call web http
post or get both method using such way
CREATE function [dbo].[HttpGetMethod]
(
@url varchar(8000)
)
returns varchar(8000)as
BEGIN
D......
|
|