EDS Visual Basic and SQL Server interview questions

  1. What is the difference between modal and modaless form in VB?
  2. Why we need a MDI form? How can we make a form as a mdichild form?
  3. Specify technical & functional architecture of your last 2 projects.
  4. What are the objects in ADODB?
  5. What are different types of cursors in ADODB?
  6. What are different types of locks in ADODB?
  7. What is disconnected recordset?
  8. Besides Standard Exe what are other types of projects in VB?
  9. What is the difference among Standard EXE, Active-X DLL, Active-X EXE?
  10. A standard exe contains a registered Active-X DLL. Now some error arise in the application but not in the standard exe , it is in the Active-X DLL. How do you find it out in which line no the error is?
  11. How can we find out that a recordset is blank (without using recordcount property)?
  12. What is the difference between procedure and functions in VB?
  13. What are the differences between stored procedure and functions in SQL Server 2000?
  14. I want to develop a stand alone application which can communicate with the existing applications in the system. On which this application should be based on: Standard Exe,Active-X Exe,Active-X Dll.
  15. can we call stored Procedure in Function in Sql Server 2000 and vice versa.
  16. What is an extended Stored Procedure?
  17. What is Trigger?
  18. Suppose I made an after Trigger on Delete. Now I fire Delete * From tablename. will this trigger work? Now do I fire truncate from table name (instead of delete command). will this trigger work now? If yes or no then why?
  19. What is a view? is View updatable?
  20. What is the difference between having and where clause?
  21. Why we need a group by clause?
  22. What is a join and their types?
  23. What is the difference between referencing and joining?
  24. What is the difference between constraints and triggers?
  25. What is the maximum size of form to hold the controls?
  26. Write the correct order of execution of following form’s events: initialization, Load, Activate, Refresh , Paint
  27. What is ACID Property of Transaction?
  28. How do we call MS- Excel in VB?
  29. What does option Explicit means?
  30. What is an index?
  31. What is normalization and its forms?
  32. What does Query_unload event do in VB? Why we need Form _unload event?
  33. What is a cursor in SQL Server 2000 and their types?
  34. How do we get month name in SQL Server 2000, Oracle, MS Access?
  35. How do we return a record set from a Stored Procedure in SQl server 2000?
  36. What are the magic tables in SQL Server 2000?
  37. What is Enum in VB?
  38. There are 2 tables:
    EMP : EmpId, Ename, Sal, DeptId
    DEPT : DeptId, Dname

  39. Write a query to find out emp names and their department names. if any emp has null in Deptid the it shows “No Department”.
  40. Write a query to find out those department names which has no employee.
  41. Write a query to find out those employees whose salary is greater than their department’s average salary.
  42. How do we get current date in SQL Server 2000, Oracle, MS Access?
This entry was posted in Database, VB, Windows. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

25 Comments on EDS Visual Basic and SQL Server interview questions

  1. srinivas
    Posted 1/23/2007 at 2:20 am | Permalink

    I have a Employee table, it consists empid,and 12 columns to store their monthly salary. Now i want to know the Max salary for an employee among the 12 months.

  2. Milind Amin
    Posted 1/25/2007 at 12:33 am | Permalink

    declare @tmp table
    (
    name varchar(10),
    jan numeric,
    feb numeric,
    mar numeric,
    apr numeric,
    may numeric,
    jun numeric,
    jul numeric,
    aug numeric,
    sep numeric,
    oct numeric,
    nov numeric,
    dec numeric
    )
    insert into @tmp values (’Milind’, 5000, 50000, 10000, 10000, 11000, 15000, 17000, 25000, 10000, 8955, 5468, 4000)
    select * from @tmp

    declare @salary table(month varchar(10), salary numeric )

    insert into @salary select ‘jan’, jan from @tmp where name = ‘Milind’
    insert into @salary select ‘feb’, feb from @tmp where name = ‘Milind’
    insert into @salary select ‘mar’, mar from @tmp where name = ‘Milind’
    insert into @salary select ‘apr’, apr from @tmp where name = ‘Milind’
    insert into @salary select ‘may’, may from @tmp where name = ‘Milind’
    insert into @salary select ‘jun’, jun from @tmp where name = ‘Milind’
    insert into @salary select ‘jul’, jul from @tmp where name = ‘Milind’
    insert into @salary select ‘aug’, aug from @tmp where name = ‘Milind’
    insert into @salary select ’sep’, sep from @tmp where name = ‘Milind’
    insert into @salary select ‘oct’, oct from @tmp where name = ‘Milind’
    insert into @salary select ‘nov’, nov from @tmp where name = ‘Milind’
    insert into @salary select ‘dec’, dec from @tmp where name = ‘Milind’

    select month, salary from @salary where salary in (select Max(salary) salary from @salary)

  3. Miriam Smith
    Posted 1/26/2007 at 3:47 pm | Permalink

    1. What is the difference between modal and modaless form in VB?
    A modal form or dialog box must be closed or hidden before you can continue working with the rest of the application.
    Modeless forms let you shift the focus between the form and another form without having to close the initial form. The user can continue to work elsewhere in any application while the form is displayed.
    ‘ Visual Basic
    Dim frmAbout as New Form()
    ‘ Display frmAbout as a modal dialog
    frmAbout.ShowDialog()

    ‘ Visual Basic
    Dim f As New Form()
    ‘ Display frmAbout as a modeless dialog.
    f.Show()

    2. Why we need a MDI form? How can we make a form as a mdichild form?
    Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window. MDI applications often have a Window menu item with submenus for switching between windows or documents.
    ‘ Visual Basic
    Protected Sub MDIChildNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
    Dim NewMDIChild As New Form2()
    ‘Set the Parent Form of the Child window.
    NewMDIChild.MdiParent = Me
    ‘Display the new form.
    NewMDIChild.Show()
    End Sub

  4. Melville
    Posted 2/9/2007 at 12:21 am | Permalink

    How do we call MS- Excel in VB?

    Dim Ex1 As Object
    Dim Ex2 As Object

    ‘open excel
    Set Ex1 = CreateObject(”excel.sheet.8″)
    Set Ex2 = Ex1.Application

    Ex2.Workbooks.Open App.Path & “\xxxx\xxxx.xls”

    Ex2.Cells(2, 1).Value = “xxxx”
    Ex2.Cells(3, 1).Value = “abcde”
    .
    .
    .
    don’t forget to close

    Ex2.ActiveWorkbook.Close 0

  5. Melville
    Posted 2/9/2007 at 12:23 am | Permalink

    What is disconnected recordset?

    Dim rs As New ADODB.Recordset
    .
    .
    .
    after finish
    rs.close

    CMIIW

  6. Krishnakumar.C
    Posted 3/5/2007 at 3:20 pm | Permalink

    #38

    Create Table EMP (EmpId Int, Ename Varchar(10), Sal Money, DeptId Int)
    Create Table DEPT ( DeptId Int, Dname Varchar(10))

    Insert into Emp Select 1, ‘Test1′, 100, 101
    Insert into Emp Select 2, ‘Test2′, 100, 102
    Insert into Emp Select 3, ‘Test3′, 100, 103
    Insert into Emp Select 4, ‘Test4′, 100, 104

    Insert into dept Select 101, ‘DEPT1′
    Insert into dept Select 102, ‘DEPT2′
    Insert into dept Select 103, ‘DEPT3′
    Insert into dept Select 104, ‘DEPT4′
    Insert into dept Select 105, ‘DEPT5′

    Select Ename, Case When Ename is NULL Then ‘Nodept’ Else DName End
    from Dept Left outer join Emp
    on Emp.deptid = Dept.Deptid

  7. Krishnakumar.C
    Posted 3/5/2007 at 3:22 pm | Permalink

    #41

    How do we get current date in SQL Server 2000

    Select Getdate()

  8. Krishnakumar.C
    Posted 3/5/2007 at 3:29 pm | Permalink

    # 39
    Write a query to find out those department names which has no employee.

    Select Dname from Dept A Where Not exists ( Select ‘x’ from Emp B Where A.Deptid = B.Deptid)

  9. Krishnakumar.C
    Posted 3/5/2007 at 3:32 pm | Permalink

    What are the magic tables in SQL Server 2000?

    1 Inserted
    2 Deleted

  10. Krishnakumar.C
    Posted 3/5/2007 at 4:31 pm | Permalink

    I have a Employee table, it consists empid,and 12 columns to store their monthly salary. Now i want to know the Max salary for an employee among the 12 months.

    Another Option
    —————

    declare @tmp table
    (
    name varchar(10),
    jan numeric,
    feb numeric,
    mar numeric,
    apr numeric,
    may numeric,
    jun numeric,
    jul numeric,
    aug numeric,
    sep numeric,
    oct numeric,
    nov numeric,
    dec numeric
    )
    insert into @tmp values (’Milind’, 5000, 60000, 60000, 600000, 11000, 15000, 17000, 25000, 10000, 8955, 5468, 4000)
    select * from @tmp

    declare @salary table(month varchar(10), salary numeric )

    insert into @salary select ‘jan’, jan from @tmp where name = ‘Milind’
    insert into @salary select ‘feb’, feb from @tmp where name = ‘Milind’
    insert into @salary select ‘mar’, mar from @tmp where name = ‘Milind’
    insert into @salary select ‘apr’, apr from @tmp where name = ‘Milind’
    insert into @salary select ‘may’, may from @tmp where name = ‘Milind’
    insert into @salary select ‘jun’, jun from @tmp where name = ‘Milind’
    insert into @salary select ‘jul’, jul from @tmp where name = ‘Milind’
    insert into @salary select ‘aug’, aug from @tmp where name = ‘Milind’
    insert into @salary select ’sep’, sep from @tmp where name = ‘Milind’
    insert into @salary select ‘oct’, oct from @tmp where name = ‘Milind’
    insert into @salary select ‘nov’, nov from @tmp where name = ‘Milind’
    insert into @salary select ‘dec’, dec from @tmp where name = ‘Milind’

    Select Month, Salary from @salary A Where 1= ( Select Count(*)+1 from @salary B Where A.Salary

  11. Brock
    Posted 3/23/2007 at 4:16 am | Permalink

    #5.What are different types of cursors in ADODB?
    Ans: Adopendynamic, adopenforwardonly, adopenkeyset, adopenstatic
    #6. What are different types of locks in ADODB?
    Ans: Adlockbatchoptimistic, adlockoptimistic, adlockpessimistic, adlockreadonly

  12. Milind Amin
    Posted 3/24/2007 at 8:45 am | Permalink

    Magic tables are create when you create trigger on the table. you will get it when your trigger getting fired.

    following is the magic table…
    1) Inserted - before value insert into actual table
    2) Deleted - before value delete from actual table
    3) Updated - before value update into actual table

    Generally it is used for applying business logic before insert or delete or update.

    example:
    CREATE TRIGGER tri_DuplicatePolicy
    ON dbo.tblLead
    INSTEAD OF INSERT
    AS
    BEGIN
    DECLARE @USERID VARCHAR(10)

    SELECT @USERID = vUserId FROM INSERTED

    IF EXISTS (SELECT vPOLICY_NO FROM TBLLEAD WHERE vPOLICY_NO = (SELECT vPOLICY_NO FROM INSERTED))
    BEGIN
    RAISERROR (’~~’, 16, 1)
    RETURN
    END
    ELSE
    BEGIN
    INSERT INTO
    tblLEAD(
    [nRetention_No],
    [vRenewal_Month],
    [nRenewal_Year],
    [vTitle],
    [vInsuredName],
    [vInsuredAdd1],
    [vInsuredAdd2],
    [vInsuredAdd3]
    )
    SELECT
    [nRetention_No],
    [vRenewal_Month],
    [nRenewal_Year],
    [vTitle],
    [vInsuredName],
    [vInsuredAdd1],
    [vInsuredAdd2],
    [vInsuredAdd3]
    FROM
    INSERTED

    INSERT INTO tblSTATUSTRIAL(iSTATUSID, biLEADID, dtCREATEDDATE,vUserId)
    VALUES(1, @@IDENTITY, GETDATE(), @USERID)
    END
    END

  13. Srivats.Y
    Posted 4/11/2007 at 3:27 pm | Permalink

    How to get month name in Oracle?

    SQL> select to_char(sysdate,’MONTH’) from dual;

  14. DD
    Posted 7/31/2007 at 1:55 pm | Permalink

    How to get month name in SQL Server 2000?

    SELECT { fn MONTHNAME(GETDATE()) } AS Expr1

  15. la Rach
    Posted 9/17/2007 at 1:05 am | Permalink

    #18

    DELETE * FROM tablename

    This operation can be rolled back and will cause all DELETE triggers on the table to fire.

    ————————
    TRUNCATE TABLE tablename

    This operation cannot be rolled back and no triggers will be fired.

  16. la Rach
    Posted 9/17/2007 at 1:06 am | Permalink

    #15

    In Stored Procedure you can call a User Define Function

    But you can’t call a SP in a User Define function

  17. la Rach
    Posted 9/17/2007 at 1:10 am | Permalink

    #13

    -functions always return one value but sp may or may not return .

    -error handling can be done in sp, but not possible in functions.

    -functions can be called from select statements, where clause and case but not possible in sp.

  18. la Rach
    Posted 9/17/2007 at 2:26 am | Permalink
  19. karthikeyan
    Posted 10/25/2007 at 5:50 am | Permalink

    Two tables are listed below
    Table1 name: Employee
    empid-> employeeId
    EmpNmae->EmployeeName
    Mgid -> ManagerId
    column :Empid,Empname,Mgid

    Table2 name : Salary
    Idno->IDNUMBER
    SalAmt ->SalaryAmount

    column : idno,salamt

    my question is finding the highest salary from the manager
    Ex: A employee salary is 5000, him manager salary is 4000
    let we show the these employee salaries are higher than the manager
    please send me the query i tried out but i not get the successfull out put

  20. Guna S
    Posted 11/21/2007 at 7:32 am | Permalink

    Q.40.
    select empid,ename from emp as e1 where salary>(select avg(sal) from emp as e2 where e1.code=e2.code)

  21. Guna S
    Posted 11/21/2007 at 7:34 am | Permalink

    Q.40
    select empid,ename from emp as e1 where sal>(select avg(sal) from emp as e2 where e1.deptid=e2.deptid)

  22. S.Guna
    Posted 11/26/2007 at 5:07 am | Permalink

    Q.39
    select dname from dept where deptid not in (select deptid from emp)

  23. Guna S
    Posted 11/29/2007 at 11:56 pm | Permalink

    How to get month name in Ms Access?

    month(date)

  24. Ashish Das(Cuttack)
    Posted 1/20/2008 at 12:59 pm | Permalink

    Difference Between Delete And Truncate..

    Delete is a DML Command. So it can be rolled back.

    Truncate is a DDL Command. So it cannot be rolled back.

    There can be where and condition with delete command. But in truncate we cannot.

    Truncate delete all the rows from the table.

  25. Ashish Das(Cuttack)
    Posted 1/20/2008 at 1:14 pm | Permalink

    1. What is the difference between modal and modaless form in VB?

    Modal form : Message Box, Input Box
    Modless Form : Form1.frm

    2. Why we need a MDI form? How can we make a form as a mdichild form?

    To group all the form in one window.

    Set Mdichild=true for any form.

    3. Specify technical & functional architecture of your last 2 projects.
    4. What are the objects in ADODB?

    Connection, Recordset, Command

    5. What are different types of cursors in ADODB?

    AdopenDynamic, adopenstatic,adopenforwardonly,AdopenKeyset
    6. What are different types of locks in ADODB?

    adLockOptimistic,adLockBatchOptimistic,adLockReadOnly,adLockPesimesic
    7. What is disconnected recordset?

    A Recordset without a live connection to a database server is called a disconnected Recordset. You can create a disconnected Recordset using the CursorLocation Recordset object property. The CursorLocation property allows you to specify whether to use client or server cursors and, most importantly, allows changes to be made in a batch mode. This example demonstrates how to create a disconnected Recordset:

    Public Function GetDisconnectedRecordset() as Object
    Dim objConnection as New ADODB.Connection
    Dim objRecordset as New ADODB.Recordset
    objConnection.Open “DSN=MyDSN;UID=sa;PWD=;”
    objRecordset.CursorLocation = adUseClient
    objRecordset.Open “Select * From Authors”, objConnection, adOpenUnspecified, adLockUnspecified
    Set GetDisconnectedRecordset = objRecordset
    End Function

    8. Besides Standard Exe what are other types of projects in VB?

    Active x exe, Activex dll

    9. What is the difference among Standard EXE, Active-X DLL, Active-X EXE?
    Active X dll is in process while active x exe is out process.

    10. A standard exe contains a registered Active-X DLL. Now some error arise in the application but not in the standard exe , it is in the Active-X DLL. How do you find it out in which line no the error is?

    If we have code for active x dll then we can put debuger their otherwise puting msgbox we can do it.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*