Quality Testing

Quality is delighting customers

1)How to fetch all the tables from DB  using sql statement?
2) What is "\" in Sql server?(Ex SQL>\)
3) SQL>@ABC  While running above statement what will you get the result?
4)How to delete the 3row 3rd column in a table? without giving any value?

Views: 292

Reply to This

Replies to This Discussion

Hi, Thx mohan.
Hi Lakshmi to fetch all the tables from DB using sql statement you can use
select * from tab;
I think select * from tab is for Oracle !! Does it also works in SQL server ? Moreover it may fetch all tables from tyeh base directory/ db......One needs to be within a particular database to fetch the table names from that very database...!!

Please correct me if I m wrong!!
Hi,
U can also use "sp_tables" command for getting tables.


Chandan

Hi,

use select * from sys.tables to fetch all the tables from a particular DB.

1> USe tablename;

SELECT * FROM sys.Tables

2> for comments MIGHT BE NOT SURE

3> IF @ABC DECLARED THEN WILL RETRURN NULL EXCEPT WLL SHOW ERROR
4>FOR DELETING ROW:
DELETE T FROM
(
SELECT ID, row_number() over(ORDER BY getdate()) as r
FROM check1
) as t
WHERE r = 3

FOR DELETING COLUMN
ALTER TABLE TABLENAME DROP COLUMN COLUMNNAME

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service