1)Get all the table name from one database
SELECT table_name FROM INFORMATION_sCHEMA.TABLES
2)count how many tables from one database
Select count(table_name) FROM INFORMATION_sCHEMA.TABLES
Saturday, July 30, 2011
TABLE SCHEMA GET COLUMN NAME FROM TABLE
SELECT COLUMN_NAME FROM INFORMATION_sCHEMA.COLUMNS WHERE TABLE_NAME='TABLENAME'
or
select * from sys.columns where object_id in(select object_id from sys.tables where name='tablename')
or
select * from sys.columns where object_id in(select object_id from sys.tables where name='tablename')
Wednesday, July 20, 2011
Windows Service Configuration Via CommandPrompt
STEP:1
Goto Run-->type cmd-->Command Prompt ---> type cd\
c:\> CD c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
Give Enter
STEP:2 (For Install Windows Service)
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /i Your Exe Path
example :
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /i D:\DirectI_RenewDomainservice\bin\DirectI_RenewDomainservice.exe
Give enter Some commands run in that command prompt
Check That Window Service
Mycomputer ->right click -->manage--> Services and application-->services-->check ur Exe Name
Step:3 (For Unistall Windows Service)
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /u Your Exe Path
example :
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /u D:\DirectI_RenewDomainservice\bin\DirectI_RenewDomainservice.exe
Goto Run-->type cmd-->Command Prompt ---> type cd\
c:\> CD c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
Give Enter
STEP:2 (For Install Windows Service)
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /i Your Exe Path
example :
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /i D:\DirectI_RenewDomainservice\bin\DirectI_RenewDomainservice.exe
Give enter Some commands run in that command prompt
Check That Window Service
Mycomputer ->right click -->manage--> Services and application-->services-->check ur Exe Name
Step:3 (For Unistall Windows Service)
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /u Your Exe Path
example :
C:\windows\Microsoft.NET\Framework\v1.14322> Installutil /u D:\DirectI_RenewDomainservice\bin\DirectI_RenewDomainservice.exe
Face Book Like Fan Box for blog
http://www.bloggerplugins.org/2011/01/facebook-like-fan-box-for-blogger.html
Custom Validations For DropDown
script type="text/javascript"
function CountryCheck(source, args)
{
var ddlCountry1 = document.getElementById ("dropweight");
var country = ddlCountry1.options[ddlCountry1.selectedIndex].value;
if (country == "0")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
script
asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="Select Unit" Display="dynamic" ControlToValidate="dropweight" ClientValidationFunction="CountryCheck" ValidationGroup="addproduct"
function CountryCheck(source, args)
{
var ddlCountry1 = document.getElementById ("dropweight");
var country = ddlCountry1.options[ddlCountry1.selectedIndex].value;
if (country == "0")
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
script
asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="Select Unit" Display="dynamic" ControlToValidate="dropweight" ClientValidationFunction="CountryCheck" ValidationGroup="addproduct"
Wednesday, July 13, 2011
DTSX execution via stored procedure
CREATE PROCEDURE [dbo].[UspEComm_StockExecutingDTSXPackage]
@IntProcessCount Int,
@dtsFileName VARCHAR(1000),
@ErrorMessage VARCHAR(250) OUTPUT
AS
BEGIN
DECLARE @decrptPassword VARCHAR(200),
@ssisstr VARCHAR(1000), @errCode INT
IF @IntProcessCount = 1
BEGIN
TRUNCATE TABLE ABEInventoryTemp
END
SET @decrptPassword = '"@r@bm0r3"'
SET @ssisstr = 'DTExec.exe /FILE "' + @dtsFileName + '" /DECRYPT ' + @decrptPassword + ' /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EW '
EXEC @errCode = xp_cmdshell @ssisstr
IF @errCode=0
BEGIN
SET @ErrorMessage='The package executed successfully.'
END
ELSE IF @errCode=1
BEGIN
SET @ErrorMessage='The package failed.'
END
ELSE IF @errCode=3
BEGIN
SET @ErrorMessage='The package was canceled by the user.'
END
ELSE IF @errCode=4
BEGIN
SET @ErrorMessage='The utility was unable to locate the requested package. The package could not be found.'
END
ELSE IF @errCode=5
BEGIN
SET @ErrorMessage='The utility was unable to load the requested package. The package could not be loaded.'
END
ELSE IF @errCode=6
BEGIN
SET @ErrorMessage='The utility encountered an internal error of syntactic or semantic errors in the command line.'
END
ELSE
BEGIN
SET @ErrorMessage='The package failed.'
END
END
/*
SYMITAR..ACCOUNT
select top 5 * from FTPDownloadReport order by idpk desc
truncate table inventorytemp
select count(*) from inventorytemp
Declare @ErrorMessage varchar(100)
EXEC UspEComm_ExecutingDTSXPackage 'D:\NewBooks\SQL Packages\I2FULLINVPackage.dtsx',@ErrorMessage
Print @ErrorMessage
*/
SET QUOTED_IDENTIFIER OFF
Subscribe to:
Posts (Atom)