Tuesday, August 20, 2019

Describe table structure with MS SQL Server


This is the second in a series of three posts about using the sp_tables, sp_columns and sp_stored_procedures stored procedures with Microsoft SQL Server databases. This post is about sp_columns which is used to describe the table structure of a SQL Server table.

The simplest way to use sp_columns to show the columns and related information about a SQL Server table is to execute the stored proecedure passing it the table name like so:

exec sp_columns MyTable


You can read more information about what each column returned means in the MSDN documentation about this stored procedure. The sp_columns stored procedure can take additional arguments to the table name. You can also pass the table owner, table qualifier (i.e. the database name), column name and the ODBC version used. The table owner and column name parameters support wildcard pattern matching, so you can use % and _ For example, if you only wanted to query the "foo" column from the above example, you would do this:

exec sp_columns MyTable, @column_name = 'foo'
If you wanted to query all columns which started with the letter "a" you could do the following:
exec sp_columns MyTable, @column_name = 'a%'
That's a basic overview of the sp_columns stored procedure for describing a table structure in Microsoft SQL Server. The final post in this series (in a week's time) will look at sp_stored_procedures to get a list of stored procedures available.

Sunday, July 21, 2019

Class for User Register - MVC

public class UserRegisterModel
    {
        [DisplayName("User Name")]
        [Required(ErrorMessage="Name can not be blank")]
        public string Name { get; set; }

        [Required(ErrorMessage = "Password can not be blank")]
        [StringLength(6,ErrorMessage="Password should be equal or less than 6 character")]
        public string Password { get; set; }

        [Required(ErrorMessage = "Email can not be blank")]
        [RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*",ErrorMessage="Email is not Valid")]
        public string Email { get; set; }
    } 

Monday, April 29, 2019

Windows 10 How to send a command line message to another PC on the network?

How to send a command line message to another PC on the network?
1. Start command prompt (cmd) – type cmd in the searchbox and run the app

2. Type the command as follows:

msg /SERVER:DestinationPC * /TIME:60 “This is the message to be sent to a PC named DestinationPC.”

– Replace DestinationPC with your destination PC name (see your computer network for the list of computers in that network if you don’t know the name pf the PC you are trying to send the message to.



– Replace the value of TIME with desired seconds before the message closes

– Replace the text between quotation marks with the message text you want to be displayed.

3. Hit enter and voila, the message is sent.

This is the relapse commend on XP Windows net send 

Monday, February 04, 2019

How to add HTML codes in Blogger Posts

If you wants to show HTML code without any customization in your blog then just use this site: SimpleCode. This method is too easy to use and it shows code in a very simple way.


Use the below
http://vault.simplebits.com/cgi-bin/simplecode.pl?mode=process



Jquery Start count and Brack timer clearTimeout()


The below JQuery Jquery Start count and Brack timer  clearTimeout()




<!DOCTYPE html>
<html>
<body>

<button onclick="startCount()">Start count!</button>
<input type="text" id="txt">
<button onclick="stopCount()">Stop count!</button>

<p>
Click on the "Start count!" button above to start the timer. The input field will count forever, starting at 0. Click on the "Stop count!" button to stop the counting. Click on the "Start count!" button to start the timer again.
</p>

<script>
var c = 0;
var t;
var timer_is_on = 0;
var myCounter = 0;

function timedCount() {
  document.getElementById("txt").value = c;
  c = c + 1;  
  
  t = setTimeout(timedCount, 1000);
  myCounter = myCounter + 1
   if(myCounter == 4)
    {
     c = 0;
     t;
     timer_is_on = 0;
     myCounter = 0;
    clearTimeout(t);
  timer_is_on = 0;
    }
   
}

function startCount() {
  if (!timer_is_on) {
    timer_is_on = 1;
    timedCount();
  
   
  }
}

function stopCount() {
 c = 0;
 t;
 timer_is_on = 0;
 myCounter = 0;
  clearTimeout(t);
  timer_is_on = 0;
}
</script>

</body>
</html>


Sunday, January 20, 2019

SQL server find search for Database , Find all stored procedures related tables




Find SP 
sp_helptext 'spname'

Find all stored procedures related tables 
SELECT *  FROM sys.procedures WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%table_name%'

Find all stored procedures newly created
SELECT *  FROM sys.procedures order by create_date desc

Find all stored procedures newly modify
SELECT *  FROM sys.procedures order by modify_date desc

Find all tables 
SELECT * FROM sys.tables

Find table with like
Select * from sys.tables  where name like '%tablename%'



SELECT
    o.name AS ReferencingObject, 
    sd.referenced_entity_name AS ReferencedObject
FROM sys.sql_expression_dependencies  AS sd
INNER JOIN sys.objects AS o
    ON o.object_id = sd.referencing_id
WHERE sd.referenced_entity_name = 'Tabel_Name';



 SELECT name, type   FROM dbo.sysobjects
 WHERE (type = 'P')