Constancia

SQL_PROC_SYS_Tablas_Campo

Jul 12th, 2015
4,652
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.55 KB | None | 0 0
  1. USE [METRICAS]
  2. GO
  3.  
  4. --****** Object      : StoredProcedure [dbo].[PROC_SYS_Tablas_Campo]
  5. --****** Autor       : Jorge Sánchez  
  6. --****** Script Date : 07/12/2015 09:35:32
  7.  
  8. SET ANSI_NULLS ON
  9. GO
  10.  
  11. SET QUOTED_IDENTIFIER ON
  12. GO
  13.  
  14. CREATE PROCEDURE [dbo].[PROC_SYS_Tablas_Campo]
  15.    @Columna VARCHAR(100)
  16. AS
  17.     SELECT A.name AS Tabla,
  18.     CASE
  19.         WHEN A.xtype = 'U' THEN 'Tabla'
  20.         WHEN A.xtype = 'V' THEN 'Vista'
  21.     END AS Tipo,
  22.     B.name AS Columna
  23.     FROM sysobjects A,syscolumns B
  24.     WHERE A.Id = B.id
  25.     AND B.name = @Columna
  26.     ORDER BY A.xtype,A.name
  27.  
  28. GO
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment