Query Analysis | Using shortcut keys
ALTER procedure Sp_getfields
@tablename varchar (100)
As
DECLARE tmpcursor cursor FOR
Select name from syscolumns where id = object_id (@tablename)
Set @fieldname = '
Set @sqlstr1 = '
Set @sqlstr2 = '
FETCH NEXT from Tmpcursor into @fieldname
While @ @fetch_status = 0
Begin
If Len (@sqlstr1) < 250-len (@fieldname)
Set @sqlstr1 = @sqlstr1 + @fieldname + ', '
Else
Set @sqlstr2 = @sqlstr2 + @fieldname + ', '
FETCH NEXT from Tmpcursor into @fieldname
End
Close Tmpcursor
Deallocate tmpcursor
If @sqlstr2 = '
Set @sqlstr1 = Left (@sqlstr1, Len (@sqlstr1)-1)
Else
Set @sqlstr2 = Left (@sqlstr2, Len (@sqlstr2)-1)
Select @sqlstr1
If @sqlstr2 <> '
Select @sqlstr2
After adding the shortcut key, in Query Analyzer, select a table name, press the corresponding shortcut key, cool bar.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.