Create tables and indexes with a Store Procedure

  • Comments posted to this topic are about the item Create tables and indexes with a Store Procedure

  • Hi

    I'm afraid it doesn't seem to work for smallint columns or table names with spaces in them...

    Jeff

  • It looks like a useful script after a little debugging. It's not returning a valid format for date fields. Here is an example that was created using the script. The script is adding a length value to the date field.

    CREATE TABLE [dbo].[Claims_Report]

    (

    [MonthEndDate] [date] (3) NULL

    ,[Initial_Closed] [float] (8) NULL

    ,[Initial_Received] [float] (8) NULL

    ,[Initial_Percentage] [float] (8) NULL

    ,[Final_Closed] [float] (8) NULL

    ,[Final_Received] [float] (8) NULL

    ,[Final_Percentage] [float] (8) NULL

    ) ON [PRIMARY]

    GO

    result:

    Msg 2716, Level 16, State 1, Line 4

    Column, parameter, or variable #1: Cannot specify a column width on data type date.

  • If you look at the script you figure out that some data type must be implemented to fit all your needs. Unfortunately, I did not need to use other data type for my needs but it is quite simple to implement those I missed.

    Just check the script and add data type you need.

    As soon as I'll get some spare time, I'll update the script for you all.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply