Skip to main content

Posts

Showing posts from February, 2015

Solution for SQL Database Backup Restore Error

Sql Error Description Facing Below Error during Restoring of SQL Database to existing database or newly created database. Restore of database 'MicrosoftDynamicsAx' failed. (  Microsoft.SqlServer.Management.RelationalEngineTasks) System.Data.SqlClient.SqlError: BACKUP LOG cannot be performed because there is no current database backup. (Microsoft.SqlServer.SmoExtended) Solution : This Error due to you have take Full SQL Backup in Read only mode. To solve this issue you can try below steps. 1.U ntick tail log backup checkbox .If you don't know about Tail log backup option then search on google to know more about tail log backup. 2. Second option is you can take full backup of database again then restore then file on database then you can deleted backed up file to free the disk space.

Intranet and Extranet,Artificial Neural Networks,Server and Workstation

Intranet and Extra net An Intranet is a private network (LAN) that uses the TCP/IP protocol suite. However, access to the network is limited only to the users inside the organization. The network uses application programs defined for the global Internet such as HTTP, and may have web servers, print servers, file servers etc. Extra net Private network that uses the Internet protocol and the public telecommunication system Shares part of a business's information with suppliers, vendors, partners, customers or other businesses. Viewed as part of a company's intranet that is extended to users outside the company. Artificial Neural Networks ARTIFICIAL NEURAL NETWORKS •Neural Networks can supplement the enormous potential of traditional computers with the ability to make sensible decisions and to learn by experience. •Neural Computation is done by a dense mesh of computing nodes and connections. They operate collectively and simultaneously on data inputs.

Structured query language,SQL Query Processing

Structured query language The common commands and methods used in it are grouped into the following categories: Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Logical Connectors, Comparison operators, Aggregate functions, Joins, Sub query, Relational operators, Where clause etc. Data definition language covers SQL commands that create and destroy database tables. Data manipulation language covers SQL commands that create, change or destroy the information in a database table or the structure of the table. Data control language covers protection to the database such as granting access to the tables. Comparison operators cover those operators that allow for comparison between two items. Aggregate function deals with those standard SQL functions that allow programmers to narrow the search of a database. Joins category covers those items that allow information from two or more tables to be related. SQL Query Processing

Limitations of computer,Introduction of Internet

Limitations of computer 1. No Feelings: Computers are not living. Hence, can’t make judgment of its own. Its instructions are based on information given to it in form of program. 2. It is Dumb: Computer posses no intelligence of it’s own. It’s I.Q. is zero. Computer can’t take it’s own decision in this regard. Definition of  Internet Internet is a worldwide network that provides an infrastructure to connect universities, government offices, companies, students, scientists, researchers and private individuals. A machine to be on the Internet means it runs TCP/IP protocol stack, has an IP address, and has the ability to send IP packets to all the other machines on the Internet. A private individual having a personal computer can call up an Internet service provider using a modem, be assigned a temporary IP address, and send IP packets to other Internet hosts.  An Internet consists of a set of connected networks that act as an integrated whole. The Internet provides universal

Application Domain,Definition of SQL Server Integration Service(SSIS).

Application Domain Application domain is nothing but a process(not exactly as normal process) where the application will be running on it. Application domain will isolates all the applications by running each application in a diff. app domain. For instance, if 5 applications are running on your system, it will then creates 5 diff app domain to guarantee the security. It also has the following advantages, 1. An application can be independently stopped. 2. An application cannot directly access code or resources in another application. 3. A fault in an application cannot affect other applications. Definition of SQL Server Integration Service(SSIS). SQL Server Integration Services (SSIS) is one of the main issues of Microsoft BI (Business Intelligence) concept representing the data integration and data transformation in the enterprise level approach. SSIS (SQL Server Integration Services) has the ability to gather data from various resources in different kinds of formats, p

SQL Tips-Bulk insert records into table ,Select into ,Insert into,delete record in chunks,Remove unused space

Bulk insert records into table in sql  This is the way to Bulk insert records into table in sql or oracle insert into  If you want to insert of table data to existing table then you need to select insert into query. E.g. INSERT   INTO   Table2 SELECT   *  FROM   Table1 insert into dTable select * from sTable It mean table2 and table1 both exists before execution of query and its simply insert data line by line. It takes more time on execution. Select into: If you want to copy of table structure with data to new table then you need to select select into query. E.g. Select * into tab1 from tab2. It means tab2 exists and tab1 does not exist in database before execution of query. After execution it will copy data of tab2 to tab1 and it will create table tab1 also. if dTable is blank and doesn't have any record. Create this as follows: definately reduce the time. CREATE TABLE dtable NOLOGGING AS SELECT * FROM stable Example of delete records from sq

Command to know the incoming network connections,transmitting data to server in unix

Command   to know the incoming network connections in unix   to know a command which would help knowing the incoming network connections through(from & to) different ip-address:ports netstat -anp | grep "port" | grep "process" Transmitting data to server through code in linux int no_of_bytes_to_send; char* buffer[100]; no_of_bytes_to_send=sizeof(buffer); while(no_of_bytes_to_send>0) { int byte_send = send(sd,buffer,no_of_bytes_to_send); no_of_bytes_to_send = no_of_bytes_to_send - byte_send; buffer+=byte_send; }

Code To Fill data table in DataGrid,fill static, get DataSet combo in asp.Net

Code To Fill DataGrid using asp.net  You can try Code To Fill DataGrid using asp.net common class. After creation these methods you need to call these method to your form editors by creating class object. Fill DataGrid Private Sub fillgrid() dim dta2 as New dataTable Dim str1 As String = "select * from receipt_detail " Dim datatb As New DataTable datatb = obj.OpenDataTable(str1, "receipt_detail") dta2.DataSource = datatb dta2.DataBind() End Sub 'Other Related Function Public Function OpenCn() As Boolean Try If cn Is Nothing Then cn = New SqlConnection End If If Not (cn.State = ConnectionState.Open) Then cn.ConnectionString = constr cn.Open() End If Finally End Try Return True End Function Public Function Closecn() As Boolean Try If Not (cn Is Nothing) Then cn.Close() End If Finally cn.Dispose() End Try Return True End Function Public Function OpenDataTable(B

Workbook Data Into One Single Sheet,Sort Alphabetic​ally ,Row column height width manipulation -MS Excel

Workbook Data Into One Single Sheet using MS Excel  If you have 10 workbook each workbook have single sheet of data (tab name should be anything) if you need consolidation sheet into all 10 workbook into one then you can do this with code use below mention code and your work will done . Sub test() Dim FS, Fle, FLDR, fles Dim Fletype As Variant Set FS = CreateObject("scripting.filesystemobject&quot ;) Dim intLstrow As Integer Dim intLstcol As Integer Dim dlgDialoge As FileDialog Dim srcsheet As Worksheet Dim wk As Workbook 'Set dlgDialoge = Application.FileDialog(msoFileDialogFolderPicker) Set wk = ThisWorkbook Set FLDR = FS.getfolder(BrowseFolder) Set fles = FLDR.Files For Each Fle In fles Fletype = Split(Fle.Name, ".") If (Fletype(UBound(Fletype)) = "xls" Or Fletype(UBound(Fletype)) = "xlsx") Then Set srcsheet = Workbooks.Open(Fle.path).Worksheets(1) intLstrow = srcsheet.Range("

Create or replace trigger before insert on field in sql

1.Create  or replace trigger before insert on field in sql Create or replace trigger t1 Before insert on Employee For each row declare v_firstname Employee.firstname%type; v_lastname Employee.lastname%type; Begin DBMS_OUTPUT.PUT_LINE('You inserted the first Name:'|| :NEW.FIRSTNAME); DBMS_OUTPUT.PUT_LINE('You inserted the first Name:'|| :NEW.LASTNAME); Begin select distinct firstname into v_firstname from Employee where firstname=:NEW.FIRSTNAME; IF(:NEW.FIRSTNAME = v_firstname) THEN DBMS_OUTPUT.PUT_LINE('This first name exists already in the table Employee.'); end if; exception when no_data_found then DBMS_OUTPUT.PUT_LINE('This first name does not exist in the table Employee.'); End; Begin select distinct lastname into v_lastname from Employee where lastname=:NEW.lastNAME; IF(:NEW.LASTNAME = v_lastname) THEN DBMS_OUTPUT.PUT_LINE('This last name exists already in the table Employee.

Select query to get Database owner and Get package name from the database in SQL

To get owner of all database in sql you can run following query in sql server query editor. select suser_sname(owner_sid) from sys.databases To get owner of particular database like Testdb is database name in sql you can run following query in sql server query editor. select suser_sname(owner_sid) from sys.databases where name = 'Testdb'  Get package name from the database query level If you  have a front end application.When a button on that page is clicked, a package is called.If you  want to find that package name from from the db level. Db level means by writing a query. How to find it? use who called me function for example OWA_UTIL.WHO_CALLED_ME(owner ,name, lineno ,caller_t ); 

Difference between primary key and unique key,Find Primary key,Index help,Not Null in SQL

Difference between primary key and unique key A table can have only one primary key but multiple unique keys. unique key may have null value which is not allowed in primary. simply primary key is unique + not null where as unique key Field contains any number of NULL values. Find primary key, index_name ,index key  using sp_Help command in sql How to find primary key, index_name and index_key in the same query For a particular table and also want to group by index_name use sysindexes table to get the output you want use the stored procedure sp_helpindex [object name] sp_help 'table name' Null and Not Null value in Primary and unique keys in sql Primary key should contain unique value and not null because if attribute value is null than how should maintain the uniqueness.. one more think i want to add that Primary key is a type of constraint and foreign key is also a type of constraint and pk is null then u can't use the null value as a foreign key. S

Simple command to shrink all database at once to reduce database size in SQL server

Simple command to shrink all database at once to reduce database size in SQL server This is very simple command to shrink all database at once to reduce database size in SQL server but one thing you need to remember do not forget to make recovery mode simple before executing this command. EXEC sp_MSForEachDB 'select ''?'' as [Database]; ALTER DATABASE [?] SET RECOVERY SIMPLE; DBCC SHRINKDATABASE (''?'' , 0)' After execution of command it will display all database name with details of size. I hope this command will help you a lot on troubleshooting of disk size. Shrinking and reducing database size in sql Summary: If there is big difference in ldf file and .bak file then you can shrink database to reduce size of database. you can use following method at Details use <dbname> checkpoint go backup log <dbname> with truncate_only, go dbccshrinkfile(<logfilename>,1000)

Re-indexes all the tables using DBCC BREINDEX command

Summary: re-indexes all the tables using DBCC BREINDEX command. This goes and re-indexes all the tables and takes about 7 minutes and make an improvement of 10% Details: USE DbName_1 --Enter the name of the database you want to reindex totally DECLARE @TableName varchar(255)  DECLARE TableCursor CURSOR FOR  SELECT YourTableName FROM information_schema.tables  WHERE table_type = 'base table'  OPEN TableCursor  FETCH NEXT FROM TableCursor INTO @TableName  WHILE @@FETCH_STATUS = 0  BEGIN  DBCC DBREINDEX(@TableName,' ',100)  FETCH NEXT FROM TableCursor INTO @TableName  END  CLOSE TableCursor  DEALLOCATE TableCursor ReIndexing All Database Tables at once in SQL Database Server This is a simple three line command for Re-indexing All Database Tables at once in SQL Database Server. This command is very helpful to improve your database performance by re indexing tables. Its Update Statistics on Tables. USE YouDatabaseName GO EXEC sp_MSforeachtable @co

SQL Stored Procedure Examples-Create,Delete and Drop Table ,insert,row count

Create,Delete and Drop Table  Through SQL Stored Procedure Following is code which you can create new Stored procedure in SQL Stored procedure section and can write following code. You can understand easily by reviewing whole code. set ANSI_NULLS OFF set QUOTED_IDENTIFIER OFF GO Create PROCEDURE [dbo].[SP_abc](@userID char(3)) AS BEGIN -- Statement to create table if NOT exists (select * from dbo.sysobjects where id = object_id('abc')) exec("CREATE TABLE abc(@field1 CHAR(3),LOGDT SMALLDATETIME,LOGTM DATETIME )") END set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO -- Statement to Delete records from table table Create PROCEDURE [dbo].[SP_DELETE](@ID1 char(3)) AS BEGIN SET NOCOUNT ON if exists (select * from dbo.sysobjects where id = object_id('L')) BEGIN DELETE FROM abc WHERE ID1=@id1 END END set ANSI_NULLS OFF set QUOTED_IDENTIFIER OFF GO -- Statement to Drop table Create PROCEDUR

SQL Join Query Tips-Example of right ,self query itselft,anti ,left join,Full outer join

Example of self join query in sql. Summary : If you are looking for information like self join query mean table used self as join let us see following example to get more clear. Hear I used  right join with self join. Example of self join query in sql,right join,self join,join query itself. select * from emp where empno not in (select e.empno from emp e right join dept d on e.empno = d.empno) How to use self join in sql select query Example of self join: To find the IDs which have a different department: select distinct A.id  from myTable A join myTable B on A.id = B.id where A.dept <> B.dept Example of join select query in sql Query to get a list of all students who have a certain checklist item (MFST) with a status of Initiated where all other checklist items have a status of Completed. Should I be using Exists or should I be using someting else? SELECT A.COMMON_ID,         B.AID_YEAR,         C.CHKLST_ITEM_CD,         C.ITEM_STATUS FROM PS_PERSON

Whate is Java Servlets ,JDBC,JAVA API,Webserver

WHAT IS JAVA SERVLETS ? An HTTP servlet can generate an HTML page, either when the servlet is accessed explicitly by name, by following a hypertext link, or as the result of a form submission. An HTTP servlet can also be embedded inside an HTML page, where it functions as a server-side include. Servlets can be chained together to produce complex effects--one common use of this technique is for filtering content. Finally, snippets of servlet code can be embedded directly in HTML pages using a new technique called JavaServer Pages. Servlets : A servlet is dynamically loaded module that services requests from Web server, by another service called response. Servlet is efficient as it is initialized only once when the web server loads it. Servlets are efficient, persistent, portable, robust, extensible, and secure, and they have facility to embed JavaScript. JDBC :  The JDBC is a pure JAVA API used to execute SQL statements. It provides the classes and interfaces that can be us

Anti Virus Tips-Remove autorun.inf folder virus,protect from virus,Best Antivirus

Remove autorun.inf folder virus 1. click on Start Button 2.then Click on Run 3. write down "cmd" in the Run box then you can see a CMD box. Here, you will write down cd...(Change directory) you can see like this C:\> then write c:\> attrib when you will write this command "attrib" it will show you all of your affected file. but you should only attentive for SHR autorun.inf and SHR AUTOTEXT.bat(these are virus) then follow this instruction>>> C:\>attrib -s -h -r autorun.inf C:\> del autorun.inf and then restart your computer. if you see this problem again then just delete autorun.inf. you should do same thing for all of your drivers. Some tips to protect from virus Here are some practical tips to help you decide whether or not to open an attached emails: 1. If you get an email with an attachment from someone you don't know, delete it. You don't take candy from strangers, and you should behave the same with email attac

SQL Select Query Examples-retrieve Last five records,subquery , last letters in capital

Select Query to retrieve Last five records of the table select * from emp a where 5 >= (select count(1) from emp b where a.empno != b.empno and a.sal <= b.sal) order by a.sal desc assumptions: 1. Empno is primary key in emp table 2. 5 last records must be required based on some sorting, so i took it as salary . Select Query to get the first and last letters in capital in SQL This is sample example to use Select Query to get the first and last letters in capital in SQL. You can use with your table instead of test5. upper is function to get letter in upper case and substr method is used to get first and last letter. select upper(substr(ename,1,1)) || substr(ename,2,length(ename)-2) || upper(substr(ename,length (ename),1)) from test5; Example of subquery in sql select e.employee_id,e.first_name||' '||last_name as name,e.department_id,e.hire_date,e.manager_id,d.department_name, m.first_name||' '||m.last_name manager from employees e join department

Tips for Linux Kernel scheduling,shutdown and restart command,steps to kernel updating

 kernel scheduling in Linux In kernel you have kernel threads. Some part of the kernel code runs in the userspace process context and some other part runs in the kernel thread context. All the userspace processes and kernel threads are scheduled with no difference except that their priority(that is both userspace process and kernel threads are treated same). we can change the kernel with our algorithm.. algorithm in sence round robin,shortest job first, fcfs, etc. You have a mirror or some part (dono the exact name) in kernel where you store your algorithm. and make kernel work in your algorithm. If your algorithm works fine without crashing the system you can set ur algorithm as default overwriting the existing one. Its possible to write your own algorithm too. scheduler schedules processes either it may be user or kernel, all user and kernel processes are same and kernel treats them in the same manor,except kernel process will not be swapped out, kernel process will have mor

Redirect output in a file,Check Exist validation,Cursor Example in PL SQL

Redirect output in a file in Oracle PL SQL There are different ways: a) Before you execute the package you can enable SPOOL. or b) Create a temporary package and insert the log messages into that so that data can be viewed later on the temporary table. or c) Use DBMS_FILE package procedure to open and write data into files. Check exists validation using pl/sql declare v_deptno dept.deptno%type:=&gdeptno; cursor deptcursor is select * from dept where deptno=v_deptno; v_deptcursor deptcursor%rowtype; begin open deptcursor; fetch deptcursor into v_deptcursor; if deptcursor%found then dbms_output.put_line('v_deptcursor.ename); else dbms_output.put_line('sorr..! no deptloyee exists..'); end if; end; PL Sql program example of cursor on employee table This is a PL Sql program example of cursor on employee table to check whether employee exist or not. declare v_empno emp.empno%type:=&gempno; cursor em

How To Upgrade Your Computer's Memory,Renaming of Drives

 Upgrade Your Computer's Memory Upgrading computer memory involves increasing the RAM of your computer, so the first thing you have to figure out is the type of RAM the system uses, how it's configured, and how many RAM slots you have available. A memory upgrade usually requires that you first check the computer's user manual, or the manual for the motherboard. Find out if the memory is parity or non-parity. You can also check the website of your computer to find out the memory you need for computer memory upgrades. Now, find out what the speed of the PC memory is. When dealing with computer memory, you have to know this information. Next, does your computer use single in-line memory modules (SIMMs) or dual in-line memory modules (DIMMs)? When conducting an upgrade, it's also key to figure out if the computer uses regular, FPM, EDO, or Synch DRAM. How many pins are on the motherboard? 30, 72, or 168? Computer memory upgrades require that you remove the cover from

Set batch file which schedules dump from database in MYSQL

Set batch file which schedules dump from database in MYSQL To Set batch file which schedules dump from database in MYSQL you can try following way. echo Running dump... c:\MYSQL\bin\mysqldump -u root -padmin --result-file="c:\back\backup_ %date%.sql" db_dm echo Done! Placing MySQL database from local computer to host You Can place MySQL database from local computer to host by following steps. Import/export file first export the database click on export tab you'll get the query for whole database copy it and paste in notepad save it with .sql extension then open your server control panel go to phpmyadmin and import the saved sql file

PHP Tips-Getting the nodes list of xml doument with responseXml in ajax ,call image save in database,time difference etc

Getting the nodes list of xml doument with responseXml in ajax var obj = ""; function callAjaxObj() { try { obj = new XMLHttpRequest(); } catch(e) { try { obj = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { obj = ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("your browser doesn't support ajax"); return false; } } } } function testResponseXml() { callAjaxObj(); obj.open("get","sample.xml",true); obj.onreadystatechange=function() { if(obj.readyState==4) { var doc = obj.responseXML.documentElement; //var doc = obj.responseXML; alert(doc.getElementsByTagName('user').length); } } obj.send(null); } Example of calender script in PHP calender script in PHP echo " $title $year "; echo "SMTWTFS"; $day_count = 1; echo ""; while (

Query to show all tables names, see all the objects,create the table into the trigger in sql

Query to show all table names select table_name from dba_tables SELECT *FROM TAB; Query to see all the objects in sql This is a very simple query to get all the objects in sql. User_Objects is sql system table which include all object information as a records. select * from USER_OBJECTS; This is small query but it could be very helpful for you. Create the table into the trigger using pl sql To create table into the trigger using pl/sql you can try following code in SQL query editor or in stored procedure. Create or replace trigger b_br after delete on EMP declare n integer; PRAGMA AUTONOMOUS_TRANSACTION; begin dbms_output.put_line('Table Creation in process..'); execute immediate 'create table b_t(b varchar2(10))'; dbms_output.put_line('Table Created..'); end; Delete from EMP; Same way you can add more columns in tables with different data types.

How to Improve Traffic To a blog,Make Your Blog Popular,Blogging platforms

Tips to Improve blog's Traffic  I t is not so easy to get traffic to each and every blog but I have experienced if you update your blog everyday then it will come on the first page of search engine (by the way always this does not work) yo can do one more thing try to use some new search word so that it will be easily accessible for search engine to get your blog just go to google and search some new word if you do not find similar blogs with that word that word is the best suit for your blog to get traffic 1. Make a habit of posting regularly in the blog. 2.Choose a proper template for your Blog. You don't expect people to like it if you have a cooking theme in a Technology blog. 3.Write a topic and post it in different sections and thereby create a series. This increases the curiosity of the web visitors who turn to the blog for the interesting follow-ups. 4.Optimize your blog to make it load Faster so that new visitor don't get annoyed to sit idle while your

DotNet ,C Sharp and SQL Interview Questions

DotNet and SQL Interview Questions 1)Say in a structure which is value type. we have added a reference type variable. will it be stored in stack memory or heap  2)in data-grid you are displaying a table. if you want to know what are the rows which are updated how do you implement it  3)suppose you want to store you connection string where are you going to store it apart from web.config and appsettings.  4)in try catch scenario there are two catch blocks one is System defined & other is user defined which will be executed first.  5)in boxing & unboxing which one is expensive.  6)difference between catch and throw  7)you have deployed windows service at client place. say suppose it is giving erroneous results. it is running application. how do you debug it.  8)there is a webservice deployed at the client place how can you check whether that application is working fine or not.  9)you have deleted a record from database from your application a at the same time so