-
-
Save ricardosiri68/6967370 to your computer and use it in GitHub Desktop.
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
ALTER PROCEDURE [dbo].[mostrarArchivos] (@Id_Usuario int, @Id_Carpeta int) | |
As | |
set nocount on | |
SELECT Id_Elemento = C.Id_Carpeta, | |
Elemento_Nombre = C.Carp_Nombre, | |
Tipo = 'Carpeta', | |
Modificado = '---' | |
FROM dbo.Usuario_Carpetas C | |
WHERE Id_Carpeta = @Id_Carpeta | |
AND Id_Usuario = @Id_Usuario | |
UNION | |
SELECT Id_Elemento = A.Id_Archivo, | |
Elemento_Nombre = A.Arc_Nombre, | |
--Esto Esta A Prueba | |
Tipo = tipoDisplay(A.Extencion), | |
Modificado = A.Arc_FechaCarga | |
FROM dbo.Usuario_Archivo A | |
WHERE Id_Carpeta = @Id_Carpeta | |
AND Id_Usuario = @Id_Usuario | |
ORDER BY | |
CASE | |
WHEN Tipo = 'carpeta' THEN 1 | |
ELSE 0 | |
END, | |
Elemento_Nombre; |
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
CREATE FUNCTION tipoDisplay (ext CHAR(20)) RETURNS CHAR(20) | |
RETURN CASE WHEN ext = 'xls' OR ext = 'xlsx' THEN 'Excel' | |
WHEN ext = 'doc' OR ext = 'docx' THEN 'Word' | |
WHEN ext = 'ppt' OR ext = 'pptx' THEN 'Power Point' | |
WHEN ext = 'txt' THEN 'Bloc de notas' | |
WHEN ext = 'pdf' THEN 'PDF' | |
WHEN ext = 'jpg' OR ext = 'jpeg' | |
OR ext = 'gif' OR ext = 'png' | |
OR ext = 'bmp' THEN 'Imagen' | |
ELSE 'Otro (' + UPPER(ext) + ')' END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment