select
*
from
sort
select top 10 * from v_companyusers where companyname like ' %杭州天下% '
create index adddateindex on v_companyusers(C_id desc )
create view V_CompanyUsers
select * from ssort where ss_id = 627
select * from companyinfo where c_id = ' 69958F6E '
as
select a. [ C_ID ] , [ CompanyName ] , [ GenderID ] , [ Introduce ] , [ LogoPath ] , [ CompanyPath ] , [ PurchaseProduct ] , [ MainProduct ] , [ DealType ] , [ CompanyType ] , [ Sort ] , [ SortOrder ] , [ regMoney ] , [ regTime ] , [ regPlace ] , [ CompanyAdderss ] , [ FoundTime ] , [ PPerson ] , [ PSex ] , [ PDept ] , [ PDuty ] , [ PAddress ] , [ PZip ] , [ PTel ] , [ PEmail ] , [ PPhone ] , [ PMobile ] , [ PFax ] , [ PQQ ] , [ PMSN ] , [ PWebSite ] , [ KeyWord ] , [ KeyStartTime ] , [ KeyEndTime ] , [ AddTime ] , [ Scores ] , [ Award ] , [ IsPass ] , [ PassTime ] , [ PassAdmin ] , [ OpenedMonth ] , [ IsPayment ] , [ IsPersonUpdate ] , [ PersonUpdateTime ] , [ IsCompanyUpdate ] , [ CompanyUpdateTime ] , [ IsContentUpdate ] , [ ContentUpdateTime ] , [ oldID1 ] , [ isdelete ] , [ U_Account ] , [ U_NickName ] , [ U_Sex ] , [ U_Password ] , [ U_Question ] , [ U_Answer ] , [ U_Note ] , [ U_Chk ] , [ U_AddTime ] , [ U_LoginNum ] , [ U_LastTime ] , [ FirstApplyDate ] , [ IsFirstPass ] , [ Reason ] , [ FirstPassDate ] , [ IsAdvancedApply ] from companyinfoa,userinfob where a.c_id = b.c_id
select * from [ zj123_b2b ] . [ dbo ] .sort where Column_name = ' 矿业设备 '
select * from b_company
select c_id,c_name,ss_id,ss_name,t.Column_id,t.column_Name from b_companya,ssortb,( select * from OPENROWSET ( ' SQLOLEDB ' , ' 127.0.0.1 ' ; ' sa ' ; '' , [ zj123_b2b ] . [ dbo ] .Sort))t where a.ssort = b.ss_id and t.column_name = b.ss_name
select distinct c_id,c_name,ss_id,ss_name,t.column_Name from b_companya,ssortb,( select * from OPENROWSET ( ' SQLOLEDB ' , ' 127.0.0.1 ' ; ' sa ' ; '' , [ zj123_b2b ] . [ dbo ] .Sort))t where a.ssort = b.ss_id and t.column_name = b.ss_name
select min (Column_id) from select min (Column_ID) from [ zj123_b2b ] . [ dbo ] .sort where group by Column_Name
-- deletefrom[zj123_b2b].[dbo].sortwhereColumn_IDnotin(selectdistinctParent_IDfrom[zj123_b2b].[dbo].sort)andColumn_IDnotin(selectmin(Column_ID)from(selectdistinct*from[zj123_b2b].[dbo].sortwhereColumn_IDnotin(selectdistinctParent_IDfrom[zj123_b2b].[dbo].sort))tgroupbyColumn_Name)
delete from ( select Column_ID from ( select distinct * from [ zj123_b2b ] . [ dbo ] .sort where Column_ID not in ( select distinct Parent_ID from [ zj123_b2b ] . [ dbo ] .sort))t group by Column_Name)t where t.Column_id not in ( select min (Column_ID) from ( select distinct * from [ zj123_b2b ] . [ dbo ] .sort where Column_ID not in ( select distinct Parent_ID from [ zj123_b2b ] . [ dbo ] .sort))t group by Column_Name)
其他未分类
delete from [ pubs ] . [ dbo ] .city
-- deletefrom[zj123_b2b].[dbo].sortwherecolumn_idin(selectcolumn_idfrom[zj123_b2b].[dbo].sortwhereColumn_idin(selectParent_idfrom(select*from[zj123_b2b].[dbo].sortwhereparent_id!='')t)andcolumn_depth=1)
select * from [ zj123_b2b ] . [ dbo ] .sort where column_name = ' 作业保护 '
select column_name, count ( * ) from [ zj123_b2b ] . [ dbo ] .sort where column_id in ( select distinct parent_id from [ zj123_b2b ] . [ dbo ] .sort) group by column_name
delete from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 66B072 '
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5DD717 ' where column_id in ( select column_id from [ zj123_b2b ] . [ dbo ] .sort where parent_id = ' 00D5CC ' )
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5D4160 ' where column_id in ( ' 56C0C7 ' )
select * from [ zj123_b2b ] . [ dbo ] .sort where parent_id = ' FE80CC '
select * from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 5E0EA9 '
select * from [ zj123_b2b ] . [ dbo ] .sort where column_name in ( select column_name from [ zj123_b2b ] . [ dbo ] .sort group by column_name having count ( * ) > 1 ) order by column_name desc
-- --------------------------------------------------------------------------------------------------
select min (Column_id), count ( * ),column_name from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 3 group by column_name having count ( * ) > 1
-- deletefrom[zj123_b2b].[dbo].sortwhereColumn_idin(selectmin(Column_id)from[zj123_b2b].[dbo].sortwherecolumn_depth=1groupbycolumn_name)
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 order by column_name
-- ------------------------------
-- --第二步
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 2 order by column_name
select min (Column_id), count ( * ),column_name from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 2 group by column_name having count ( * ) > 1
select * from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 0BAF08 '
-- ------------------------------
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 order by column_name desc ,column_id
select max (Column_id),column_name, count ( * ) from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 group by column_name having count ( * ) >= 1
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 3 order by column_name where column_id = ' 0BAF08 '
-- -------------------------------------------------------------------------------/////////////////
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 0796CE ' where parent_id = ' 19E861 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 9671CF ' where parent_id = ' D4FD84 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5A6E06 ' where parent_id = ' 6073F5 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' AC3D13 ' where parent_id = ' DC5E01 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 74F0CB ' where parent_id = ' A61268 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 6103A9 ' where parent_id = ' 6C5C7E ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 4CC1DF ' where parent_id = ' F68730 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 6A726A ' where parent_id = ' 9CC1B5 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' C2DFDB ' where parent_id = ' D578E2 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 2A5475 ' where parent_id = ' C89C65 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 037721 ' where parent_id = ' E06107 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 8A62FE ' where parent_id = ' F256E9 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 70B5BD ' where parent_id = ' F24EC3 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 82F523 ' where parent_id = ' C591DE ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 72F93F ' where parent_id = ' 8A0552 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5E0EA9 ' where parent_id = ' 19E861 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 0796CE ' where parent_id = ' CEBE72 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = <
select top 10 * from v_companyusers where companyname like ' %杭州天下% '
create index adddateindex on v_companyusers(C_id desc )
create view V_CompanyUsers
select * from ssort where ss_id = 627
select * from companyinfo where c_id = ' 69958F6E '
as
select a. [ C_ID ] , [ CompanyName ] , [ GenderID ] , [ Introduce ] , [ LogoPath ] , [ CompanyPath ] , [ PurchaseProduct ] , [ MainProduct ] , [ DealType ] , [ CompanyType ] , [ Sort ] , [ SortOrder ] , [ regMoney ] , [ regTime ] , [ regPlace ] , [ CompanyAdderss ] , [ FoundTime ] , [ PPerson ] , [ PSex ] , [ PDept ] , [ PDuty ] , [ PAddress ] , [ PZip ] , [ PTel ] , [ PEmail ] , [ PPhone ] , [ PMobile ] , [ PFax ] , [ PQQ ] , [ PMSN ] , [ PWebSite ] , [ KeyWord ] , [ KeyStartTime ] , [ KeyEndTime ] , [ AddTime ] , [ Scores ] , [ Award ] , [ IsPass ] , [ PassTime ] , [ PassAdmin ] , [ OpenedMonth ] , [ IsPayment ] , [ IsPersonUpdate ] , [ PersonUpdateTime ] , [ IsCompanyUpdate ] , [ CompanyUpdateTime ] , [ IsContentUpdate ] , [ ContentUpdateTime ] , [ oldID1 ] , [ isdelete ] , [ U_Account ] , [ U_NickName ] , [ U_Sex ] , [ U_Password ] , [ U_Question ] , [ U_Answer ] , [ U_Note ] , [ U_Chk ] , [ U_AddTime ] , [ U_LoginNum ] , [ U_LastTime ] , [ FirstApplyDate ] , [ IsFirstPass ] , [ Reason ] , [ FirstPassDate ] , [ IsAdvancedApply ] from companyinfoa,userinfob where a.c_id = b.c_id
select * from [ zj123_b2b ] . [ dbo ] .sort where Column_name = ' 矿业设备 '
select * from b_company
select c_id,c_name,ss_id,ss_name,t.Column_id,t.column_Name from b_companya,ssortb,( select * from OPENROWSET ( ' SQLOLEDB ' , ' 127.0.0.1 ' ; ' sa ' ; '' , [ zj123_b2b ] . [ dbo ] .Sort))t where a.ssort = b.ss_id and t.column_name = b.ss_name
select distinct c_id,c_name,ss_id,ss_name,t.column_Name from b_companya,ssortb,( select * from OPENROWSET ( ' SQLOLEDB ' , ' 127.0.0.1 ' ; ' sa ' ; '' , [ zj123_b2b ] . [ dbo ] .Sort))t where a.ssort = b.ss_id and t.column_name = b.ss_name
select min (Column_id) from select min (Column_ID) from [ zj123_b2b ] . [ dbo ] .sort where group by Column_Name
-- deletefrom[zj123_b2b].[dbo].sortwhereColumn_IDnotin(selectdistinctParent_IDfrom[zj123_b2b].[dbo].sort)andColumn_IDnotin(selectmin(Column_ID)from(selectdistinct*from[zj123_b2b].[dbo].sortwhereColumn_IDnotin(selectdistinctParent_IDfrom[zj123_b2b].[dbo].sort))tgroupbyColumn_Name)
delete from ( select Column_ID from ( select distinct * from [ zj123_b2b ] . [ dbo ] .sort where Column_ID not in ( select distinct Parent_ID from [ zj123_b2b ] . [ dbo ] .sort))t group by Column_Name)t where t.Column_id not in ( select min (Column_ID) from ( select distinct * from [ zj123_b2b ] . [ dbo ] .sort where Column_ID not in ( select distinct Parent_ID from [ zj123_b2b ] . [ dbo ] .sort))t group by Column_Name)
其他未分类
delete from [ pubs ] . [ dbo ] .city
-- deletefrom[zj123_b2b].[dbo].sortwherecolumn_idin(selectcolumn_idfrom[zj123_b2b].[dbo].sortwhereColumn_idin(selectParent_idfrom(select*from[zj123_b2b].[dbo].sortwhereparent_id!='')t)andcolumn_depth=1)
select * from [ zj123_b2b ] . [ dbo ] .sort where column_name = ' 作业保护 '
select column_name, count ( * ) from [ zj123_b2b ] . [ dbo ] .sort where column_id in ( select distinct parent_id from [ zj123_b2b ] . [ dbo ] .sort) group by column_name
delete from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 66B072 '
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5DD717 ' where column_id in ( select column_id from [ zj123_b2b ] . [ dbo ] .sort where parent_id = ' 00D5CC ' )
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5D4160 ' where column_id in ( ' 56C0C7 ' )
select * from [ zj123_b2b ] . [ dbo ] .sort where parent_id = ' FE80CC '
select * from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 5E0EA9 '
select * from [ zj123_b2b ] . [ dbo ] .sort where column_name in ( select column_name from [ zj123_b2b ] . [ dbo ] .sort group by column_name having count ( * ) > 1 ) order by column_name desc
-- --------------------------------------------------------------------------------------------------
select min (Column_id), count ( * ),column_name from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 3 group by column_name having count ( * ) > 1
-- deletefrom[zj123_b2b].[dbo].sortwhereColumn_idin(selectmin(Column_id)from[zj123_b2b].[dbo].sortwherecolumn_depth=1groupbycolumn_name)
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 order by column_name
-- ------------------------------
-- --第二步
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 2 order by column_name
select min (Column_id), count ( * ),column_name from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 2 group by column_name having count ( * ) > 1
select * from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 0BAF08 '
-- ------------------------------
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 order by column_name desc ,column_id
select max (Column_id),column_name, count ( * ) from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 group by column_name having count ( * ) >= 1
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 3 order by column_name where column_id = ' 0BAF08 '
-- -------------------------------------------------------------------------------/////////////////
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 0796CE ' where parent_id = ' 19E861 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 9671CF ' where parent_id = ' D4FD84 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5A6E06 ' where parent_id = ' 6073F5 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' AC3D13 ' where parent_id = ' DC5E01 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 74F0CB ' where parent_id = ' A61268 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 6103A9 ' where parent_id = ' 6C5C7E ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 4CC1DF ' where parent_id = ' F68730 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 6A726A ' where parent_id = ' 9CC1B5 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' C2DFDB ' where parent_id = ' D578E2 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 2A5475 ' where parent_id = ' C89C65 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 037721 ' where parent_id = ' E06107 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 8A62FE ' where parent_id = ' F256E9 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 70B5BD ' where parent_id = ' F24EC3 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 82F523 ' where parent_id = ' C591DE ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 72F93F ' where parent_id = ' 8A0552 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5E0EA9 ' where parent_id = ' 19E861 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 0796CE ' where parent_id = ' CEBE72 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = <
发表评论
评论