SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%ColumnName%'
ORDER BY schema_name, table_name;Friday, September 20, 2013
Query to Find Column From All Tables of Database
Tuesday, September 3, 2013
How to change the Change/Assign Dropdown/Radio Button Values in Jquery Mobile
Method #1 ( DropDown )
var
countrySetValue = $("#deliveryMethod");
$('#deliveryMethod').val('-1');
countrySetValue.selectmenu("refresh", true);
Method #2 ( DropDown )
$("#deliveryMethod").selectmenu("refresh",
true);
Method #1 ( Radio Button )
$('input[name=PaymentType]').removeAttr('checked').checkboxradio("refresh");
Saturday, April 27, 2013
How to execute Sql Script using Command prompt
E:\>sqlcmd -ddbname
–S.\SqlExpress -Usa -PWelcome123 -iScript.sql
The above command
script for Sql Server login authentication
1 1) You have to
copy the Sql Script file to any drive. Here I have used E drive.
2 2) In the
command prompt you have to select the drive where you have copied the script
file.
3 3) Before
execute the script you have to create the new database. Here I have created dbname as Database name.
4 4) dbname is the Database name.
5 5) .\SqlExpress is the Sql server instance name.
6 6) sa is the
username of the Sql Server.
7 7) Welcome123 is the password of the Sql Server.
8 8) Script.sql is the Script file.
Monday, April 8, 2013
Jquery Inline form validation how to disable submit button
jQuery("#formname").validationEngine('attach', {
onValidationComplete: function (form, status) {
if (status == true) {
$('#Btname').attr('disabled', true);
return true;
}
}
});
jQuery("#formname").validationEngine('attach', {
onValidationComplete: function (form, status) {
if (status == true) {
$('#Btname').attr('disabled', true);
return true;
}
}
});
Monday, April 1, 2013
How to convert string to TitleCase
public static String
TitleCaseString(String s)
{
if (s == null) return s;
String[]
words = s.Split(' ');
for (int i = 0; i < words.Length; i++)
{
if
(words[i].Length == 0) continue;
Char
firstChar = Char.ToUpper(words[i][0]);
String
rest = "";
if
(words[i].Length > 1)
{
rest = words[i].Substring(1).ToLower();
}
words[i] = firstChar + rest;
}
return String.Join("
", words);
}
How to convert string to SentenceCase
public static string
SentenceCase(string text)
{
string
temporary = text.ToLower();
string
result = "";
while
(temporary.Length > 0)
{
string[] splitTemporary =
SplitAtFirstSentence(temporary);
temporary = splitTemporary[1];
if (splitTemporary[0].Length > 0)
{
result +=
CapitaliseSentence(splitTemporary[0]);
}
else
{
result +=
CapitaliseSentence(splitTemporary[1]);
temporary = "";
}
}
return result;
}
private static string
CapitaliseSentence(string sentence)
{
string
result = "";
while
(sentence[0] == ' ')
{
sentence = sentence.Remove(0, 1);
result += "
";
}
if
(sentence.Length > 0)
{
result += sentence.TrimStart().Substring(0,
1).ToUpper();
result += sentence.TrimStart().Substring(1,sentence.TrimStart().Length - 1);
}
return
result;
}
private static string[]
SplitAtFirstSentence(string text)
{
int
lastChar = text.IndexOfAny(new char[] { '.', ':', '\n', '\r', '!', '?' }) + 1;
if (lastChar
== 1)
{
lastChar = 0;
}
return new string[] {
text.Substring(0, lastChar),text.Substring(lastChar,
text.Length - lastChar) };
}
Subscribe to:
Posts (Atom)