stacktrace | at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at System.Data.SqlClient.SqlDataReader.Read()
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at sql_util.sql_utils_core.data_set_sqlclient(String sql, Int32& n_linhas_afetadas, TimeSpan& duracao_conexao, Int32 n_tentativa, String nome_dataset)
at sql_util.sql_utils_core.data_set_sqlclient(String sql)
at sql_util.sql_utils_core.data_set_sqlclient2(Object[] objs)
at tecnomidia.product.carrega_dataset2()
at tecnomidia.product.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
SELECT TOP 20
produtos.cod
,produtos.sku
,produtos.nome_pequeno
,image_file
,produtos.short_description
,produtos.url_friendly
,produtos.url_friendly_name
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,produtos.status
,produtos.estoque
,produtos.b2w_market_place
,produtos.frete_gratis as frete_gratis_produto
,produtos.cod_marca
,produtos.cod_tipo_status
,url_friendly_dept = (select techloja_dept.url_friendly as url_friendly_dept from techloja_dept where dept_id = produtos.dept_id)
,url_friendly_marca = (select marcas.url_friendly as url_friendly_marca from marcas where cod_marca = produtos.cod_marca)
,produtos.preco_sem_promocao
,produtos.exibe_preco_sem_promocao
,produtos.preco_exibicao_maior_pacote
,imagens_dimensoes.width_real
,imagens_dimensoes.height_real
,produtos.preco
,menor_unidade = (select min(unidades) as min_unidade from produtos_pacotes where sku = produtos.sku)
,preco_menor_pacote = (select reference_price as preco from produtos_pacotes where sku = produtos.sku and unidades = 1)
,n_pacotes = (select count(cod_produtos_pacotes) as preco from produtos_pacotes where sku = produtos.sku)
,peso = (select top 1 case when peso_volumetrico > peso then peso_volumetrico else peso end from produtos_pacotes where sku = produtos.sku order by peso)
,produtos_valores_herdados.cod as cod_produtos_valores_herdados
,produtos_valores_herdados.db_preco_sem_desconto
,produtos_valores_herdados.db_valor_parcela_sem_juros
,produtos_valores_herdados.db_valor_parcela_com_juros
,produtos_valores_herdados.max_parcelas_com_juros_parcela_minima
,produtos_valores_herdados.max_parcelas_sem_juros_parcela_minima
,produtos_valores_herdados.texto_sem_desconto
,produtos_valores_herdados.max_parcelas_sem_juros
,produtos_valores_herdados.max_parcelas_com_juros
,produtos_valores_herdados.juros_vista
,produtos_valores_herdados.juros_vista_operador
,produtos_valores_herdados.juros_mensal
,produtos_valores_herdados.juros_mensal_operador
,produtos_valores_herdados.prazo_entrega
,produtos_valores_herdados.frete_gratis
,produtos_valores_herdados.frete_gratis_cod_regiao
,produtos_valores_herdados.frete_gratis_dt_inicial
,produtos_valores_herdados.frete_gratis_dt_final
,produtos_valores_herdados.produtos_preco
FROM (
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,0 as ordem_principal
,ordem = (
case
when exists(select cod_atributo from produtos_atributos where cod_atributo = 5701 and cod_produto = produtos.cod) then
1
else
0
end
-
case
when exists(select cod_atributo from produtos_atributos where cod_atributo = 6152 and cod_produto = produtos.cod) then
1
else
0
end
-
case
when exists(select cod_atributo from produtos_atributos where cod_atributo = 6560 and cod_produto = produtos.cod) then
1
else
0
end
-
case
when exists(select cod_atributo from produtos_atributos where cod_atributo = 5202 and cod_produto = produtos.cod) then
1
else
0
end
)
from
produtos
where
cod in (
select
cod_produto
from
produtos_atributos
where
cod_atributo in (
select
cod_atributo
from
produtos_atributos
where
cod_produto = 27851
)
)
and
produtos.status <> 0
union
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,1 as ordem_principal
,techloja_dept_prod.ordem
from
produtos
left join techloja_dept_prod
on (produtos.sku = techloja_dept_prod.sku and techloja_dept_prod.dept_id = 9686)
where
produtos.name like '6 pçs%'
and
produtos.status <> 0
and
produtos.cod_tipo_produto = 225
union
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,2 as ordem_principal
,techloja_dept_prod.ordem
from
produtos
left join techloja_dept_prod
on (produtos.sku = techloja_dept_prod.sku and techloja_dept_prod.dept_id = 9686)
where
produtos.name like '%6 pçs%'
and
produtos.status <> 0
and
produtos.cod_tipo_produto = 225
union
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,3 as ordem_principal
,techloja_dept_prod.ordem
from
produtos
left join techloja_dept_prod
on (produtos.sku = techloja_dept_prod.sku and techloja_dept_prod.dept_id = 9686)
where
produtos.name like '6%'
and
produtos.status <> 0
and
produtos.cod_tipo_produto = 225
union
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,4 as ordem_principal
,techloja_dept_prod.ordem
from
produtos
left join techloja_dept_prod
on (produtos.sku = techloja_dept_prod.sku and techloja_dept_prod.dept_id = 9686)
where
produtos.dept_id = 9686
and
produtos.sku like '9300745%'
and
produtos.status <> 0
and
produtos.cod_tipo_produto = 225
union
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,5 as ordem_principal
,techloja_dept_prod.ordem
from
produtos
left join techloja_dept_prod
on (produtos.sku = techloja_dept_prod.sku and techloja_dept_prod.dept_id = 9686)
where
produtos.dept_id = 9686
and
produtos.status <> 0
and
produtos.cod_tipo_produto = 225
union
select
produtos.sku
,produtos.name
,ativado = replace(produtos.status, 0, 4)
,6 as ordem_principal
,ordem = case
when produtos.cod_tipo_produto = 225 then
0
else
1
end
from
produtos
left join techloja_dept_prod
on (produtos.sku = techloja_dept_prod.sku and techloja_dept_prod.dept_id = 9686)
where
produtos.dept_id in (
select
dept_id
from
techloja_dept
where
parent_id in (
select
techloja_dept2.parent_id
from
techloja_dept
as
techloja_dept2
where
techloja_dept2.dept_id = 9686
)
)
and
produtos.status <> 0
)
AS
produtos_relacionados
INNER JOIN produtos
ON (produtos.sku = produtos_relacionados.sku)
LEFT JOIN produtos_valores_herdados
on (produtos.cod = produtos_valores_herdados.cod_produto)
LEFT JOIN imagens_dimensoes
ON (
produtos.sku = imagens_dimensoes.cod_imagem
AND
imagens_dimensoes.width_solicitado = 130
AND
imagens_dimensoes.height_solicitado = 130
AND
imagens_dimensoes.cod_tipo = 1
)
WHERE
produtos.sku <> '93007453'
AND
0 < (select count(cod_produtos_pacotes) as preco from produtos_pacotes where sku = produtos.sku)
GROUP BY
produtos.cod
,produtos.sku
,produtos.nome_pequeno
,image_file
,produtos.short_description
,produtos.url_friendly
,produtos.url_friendly_name
,produtos.name
--,ativado = replace(produtos.status, 0, 4)
--,0 as ordem
,produtos.status
,produtos.b2w_market_place
,produtos.frete_gratis
,produtos.estoque
,produtos.cod_marca
,produtos.cod_tipo_status
--,url_friendly_dept = (select techloja_dept.url_friendly as url_friendly_dept from techloja_dept where dept_id = produtos.dept_id)
,produtos.dept_id
,produtos.preco_sem_promocao
,produtos.exibe_preco_sem_promocao
,produtos.preco_exibicao_maior_pacote
,imagens_dimensoes.width_real
,imagens_dimensoes.height_real
,produtos.preco
--,menor_unidade = (select min(unidades) as min_unidade from produtos_pacotes where sku = produtos.sku)
--,preco_menor_pacote = (select reference_price as preco from produtos_pacotes where sku = produtos.sku and unidades = 1)
--,n_pacotes = (select count(cod_produtos_pacotes) as preco from produtos_pacotes where sku = produtos.sku)
,produtos_valores_herdados.cod
,produtos_valores_herdados.db_preco_sem_desconto
,produtos_valores_herdados.db_valor_parcela_sem_juros
,produtos_valores_herdados.db_valor_parcela_com_juros
,produtos_valores_herdados.max_parcelas_com_juros_parcela_minima
,produtos_valores_herdados.max_parcelas_sem_juros_parcela_minima
,produtos_valores_herdados.texto_sem_desconto
,produtos_valores_herdados.max_parcelas_sem_juros
,produtos_valores_herdados.max_parcelas_com_juros
,produtos_valores_herdados.juros_vista
,produtos_valores_herdados.juros_vista_operador
,produtos_valores_herdados.juros_mensal
,produtos_valores_herdados.juros_mensal_operador
,produtos_valores_herdados.prazo_entrega
,produtos_valores_herdados.frete_gratis
,produtos_valores_herdados.frete_gratis_cod_regiao
,produtos_valores_herdados.frete_gratis_dt_inicial
,produtos_valores_herdados.frete_gratis_dt_final
,produtos_valores_herdados.produtos_preco
ORDER BY
replace(produtos.status, 0, 4) --produtos_relacionados.ativado
,MIN(produtos_relacionados.ordem_principal)
,MIN(produtos_relacionados.ordem)
;
|