Archive

Archive for the ‘Programming’ Category

MSSQL useful tips

March 13, 2012 Leave a comment
  • MSSQL set null when value is not numeric in select query
SELECT CASE ISNUMERIC(column1) WHEN 1 THEN column1 ELSE NULL END FROM table1
  • SQL Server Error Messages – Msg 8152 – String or binary data would be truncated.  The statement has been terminated.

This error message is occurred when I tried to insert data to values from another table.It’s due to one column in the table that im inserting data have lesser length than other table column.(varchar(25) – varchar(max)).It couldn’t found previously because second table column I have used max length but when inserting data it filled with strings that contains more than 25 characters.

I found another command to skip that error and continue but its like a try catch statement without catch part(thanks yasindu bro for nice example).

SET ANSI_WARNINGS OFF

Need to use above command before inserting records.but sometimes it’s not working

  • Inserting multiple records to a table

This isn’t simple thing but I previously work with MySQL and that is different and we can’t use

INSERT INTO tblName (column1,column2)
VALUES
('Value1','value11'),
('Value2','value22'),
('Value3','value33')
INSERT INTO tblName (column1,column2)
select ‘Value1′,’Value11’
UNION ALL
select ‘Value2′,’Value22’
UNION ALL
select ‘Value3′,’Value33’
Categories: Issues, Programming, TSQL Tags: , ,

Back to Java Basics-star problems-1

April 26, 2011 Leave a comment
 1: package star;
 2: import java.util.Scanner;
 3: public class Main {
 4:     public static void main(String[] args) {
 5:         Scanner input=new Scanner(System.in);
 6:         System.out.print("Enter No\n");
 7:         int n=input.nextInt();
 8:
 9:         for(int b=0;b<n;b++){
 10:             for(int a=0;a<b+1;a++){
 11:                 System.out.print("*");
 12:             }
 13:             System.out.print("\n");
 14:         }
 15:     }
 16: }
 17:

output:

Enter No
5

*

**

***

****

*****

Read more…

Categories: Programming Tags: , ,

C#.Net (Short Notes)

April 26, 2011 Leave a comment
  • no multiple inheritance
  • no pointers(insafe)
  • operator overloading
  • enumerations
  • preprocessor directives
  • CLR-The Common Language Runtime
    • It’s a framework layer the resides above the OS and handles the execution of all .net Applications
    • our .Net Applications

      CLR

      Windows OS

  • MSIL-Microsoft Intermediate Language
    • OS & Hardware independence with cross language relationship
      .Net Code Language Compiler—> MISL
      Code
      Just In Time Compiler(JITler)—> Execution
      native code
  • FCL-The Framework Class Library
    • It contains thousands of classes to provide access to window API and common to common Data Structure,IO,Thread,Streams,Security and network programming
  • CLS-The Common Language Specification
    • It guaranteed to be usable in any other .Net Language
  • CTS-The Common Type System
    • Each .Net compliant language should map its data types to these standard data types
  • GC-Garbage Collection
    • Dynamically allocates memory space
  • The Visual Studio.Net IDE
    • IDE,Debugger,Project & Solution Explorer,Class, properties tab,tool box,standard menu and toolbars.
    • Our .Net Application:-WinForms, WebApp, Web services
      Data(ADO.Net) and XML Library
      FCL:-IO,Socket,Stream,Reflect,UI
      CLR:-Debugger,JIT,Exceptions,GC,Threads
      Windows OS
  • Namespace in C#-simply a logical collection of related classes.