If you are asking how to retrive Data from that table u can simply use a select statement...
Select Column1,Column2,Column3 From TableName Where Column1='ReqdTableName'
There is a View Called
INFORMATION_SCHEMA.COLUMNS in Sql Server.. You can use that view to select the ColumnNames, Datatype of the columns of a Particular Table...
Select COLUMN_NAME From INFORMATION_SCHEMA.COLUMNS
Where TABLE_NAME='TableName'
Updated:
U can use a
CURSOR[
^] or
WHILE[
^] to loop through the records...Cursor Example:
Declare @CurTest Cursor,@Tablename varchar(40),@Columnname Varchar(40)
Set @CurTest = Cursor Fast_Forward
For
Select Tablename, Columnname from Lkuptable
Open @CurTest
Fetch Next From @CurTest into @Tablename ,@Columnname
While @@FETCH_STATUS=0
Begin
Print @Tablename ,@Columnname
Fetch Next From @CurTest into @Tablename ,@Columnname
End
the above cursor will simply loop through all the tablename,columname one by one and displays the TableName and ColumnName
Declare @Flag int,@Id int,@PrevId Int,@Data varchar(40)
Set @Flag=1
While @Flag =1
Begin
Set @Data=''
Select Top(1) @Data=Column ,@Id=id from tableName where ID>@PrevId
If @Data=''
Break;
Set @PrevId=@Id
End