Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
baburk
Posting Yak Master
108 Posts |
Posted - 2009-10-05 : 01:07:55
|
| We are having 125 tables and more than 1800 sp in our database with 8 schema.Lots of sps are given with wrong data type and size.Can anybody help me to find it out by sp and schema wise.CREATE TABLE [UserDetails].[DTUser]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](50) NULL, [Address] [varchar](30) NULL, [State] [nvarchar](80) NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFGOCREATE PROCEDURE [UserDetails].[DTUserInsert]-- Add the parameters for the stored procedure here @Name nvarchar(30), @Address nvarchar(30), @State nvarchar(30)AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here INSERT INTO [UserDetails].[DTUserInsert] ( [Name] , [Address] , [State] ) VALUES ( @Name , @Address , @State ) END GOThanks,Babu Kumarasamy |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-10-05 : 07:28:39
|
| This is how you can get the data types of the parmaters in your sprocs. Your post is pretty vague, so you'll have to be more specific if you want a more precise answerselect object_name(par.object_id),[ProcedureName] = par.name ,st.[Name],st.schema_id,st.max_length,st.precision,st.scalefrom sys.parameters parinner join sys.types st onpar.system_type_id = par.system_type_idand par.user_type_id = st.user_type_idJimEveryday I learn something that somebody else already knew |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-05 : 14:11:44
|
| i think you need to start with sp_depends to get dependent routines of a table and then look for column names against params. otherwise, there can be chance of same field names existing on multiple table with different types and you cant correlate which one procedure is refering to |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
baburk
Posting Yak Master
108 Posts |
Posted - 2009-10-06 : 00:15:00
|
quote: Originally posted by jimf This is how you can get the data types of the parmaters in your sprocs. Your post is pretty vague, so you'll have to be more specific if you want a more precise answerselect object_name(par.object_id),[ProcedureName] = par.name ,st.[Name],st.schema_id,st.max_length,st.precision,st.scalefrom sys.parameters parinner join sys.types st onpar.system_type_id = par.system_type_idand par.user_type_id = st.user_type_idJimEveryday I learn something that somebody else already knew
Hi you gave me a good reply.SELECT * FROM INFORMATION_SCHEMA.COLUMNSSELECT * FROM INFORMATION_SCHEMA.PARAMETERSHow can I able to match the Table Columns and the Parameters.Thanks. |
 |
|
|
|
|
|
|
|