Convert string currency value to decimal value

Filed in .Net Leave a comment

public static decimal ConvertCurrencyToDecimal(string Value)

{

if (Value == “$0.00″)

return 0;

else if (Value.Length == 0)

return 0;

else

return Decimal.Parse(Value.Replace(” “, “”), NumberStyles.Any | NumberStyles.AllowCurrencySymbol | NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint, new CultureInfo(“en-US”));

}

Inserting data into a duplicate table, without entering column names

Filed in SQL Leave a comment

INSERT INTO DeletedPK SELECT * FROM PK WHERE PKId = 33

Creating a table by coping old table structure copy in SQL 2005

Filed in SQL Leave a comment

E.g 1

SELECT * INTO NewTblName FROM ExistingTblName WHERE 1 = 0

E.g 2

SELECT * INTO NewTblName FROM

(SELECT PKId, PKStatusId, P.CreatedDate, P.LastModifiedDate, PayOptId, AccountNo, RoutingNo, Pin, DedOfferAmount,  IntTrackNo, Lang, RequestUrl, PCode, PromoCodeAmount, S.[SId], FirstName, LastName, Address1, Address2, Address3, City, [State], ZipCode, Country, Phone, Email, [Password]  FROM Sel S, Pro P WHERE 1 = 0 ) AB

TOP