This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT sc.name +'.'+ ta.name TableName | |
,SUM(pa.rows) RowCnt | |
FROM sys.tables ta | |
INNER JOIN sys.partitions pa | |
ON pa.OBJECT_ID = ta.OBJECT_ID | |
INNER JOIN sys.schemas sc | |
ON ta.schema_id = sc.schema_id | |
WHERE ta.is_ms_shipped = 0 AND pa.index_id IN (1,0) | |
GROUP BY sc.name,ta.name | |
ORDER BY SUM(pa.rows) DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select partido, referencia, max(IF(numerovoto=58021,posicioncodigo,0)) '58021', | |
max(IF(numerovoto=58022,posicioncodigo,0)) '58022' from | |
( | |
select v.partido, v.referencia, v.NumeroVoto, v.posicioncodigo from voto_ok v | |
inner join votacionscore vs on v.NumeroVoto = vs.NumeroVoto and v.Legislatura = vs.legislatura | |
where v.Legislatura = 58 | |
and vs.Presupuesto > 1 | |
order by v.partido, v.Referencia, v.numerovoto | |
) votostats | |
group by partido, referencia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function MERGEVALUES(rn As Range, del As String) | |
Dim cell As Range | |
Dim result As String | |
Dim index As Integer | |
Dim textSplit As Variant | |
Dim curVal As String | |
For Each cell In rn | |
textSplit = Split(cell.text, del) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO gobi.votacion_def | |
(Legislatura, Descripcion, Sesion, Fecha, VotacionTotal, VotacionNum) | |
select Legislatura, Descripcion, str_to_date(Sesion, '%m/%d/%Y'), Fecha, VotacionTotal, VotacionNum | |
from tesis.votaciones; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE DatabaseName | |
GO | |
SELECT column_name 'Column Name', | |
data_type 'Data Type', | |
CHARacter_maximum_length 'Maximum Length' | |
FROM information_schema.columns | |
WHERE table_name = 'TableName' | |
GO |