Click here to Skip to main content
15,895,256 members
Home / Discussions / Database
   

Database

 
GeneralRe: Update a datatable to database Pin
Bluebamboo14-Feb-08 8:41
Bluebamboo14-Feb-08 8:41 
GeneralRe: Update a datatable to database Pin
Joe14-Feb-08 18:48
Joe14-Feb-08 18:48 
GeneralPassing Parameters to Strored Procedure Pin
dnsl13-Feb-08 23:36
dnsl13-Feb-08 23:36 
GeneralRe: Passing Parameters to Strored Procedure [modified] Pin
Vimalsoft(Pty) Ltd14-Feb-08 20:13
professionalVimalsoft(Pty) Ltd14-Feb-08 20:13 
GeneralRe: Passing Parameters to Strored Procedure Pin
Ashfield15-Feb-08 9:48
Ashfield15-Feb-08 9:48 
Generalerror in local works fine in server Pin
new2pgrmg13-Feb-08 23:21
new2pgrmg13-Feb-08 23:21 
GeneralRe: error in local works fine in server Pin
Joe14-Feb-08 0:03
Joe14-Feb-08 0:03 
GeneralRe: error in local works fine in server Pin
new2pgrmg14-Feb-08 1:13
new2pgrmg14-Feb-08 1:13 
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author: <author,,jiju>
-- Create date: <create date,14.2.2008,="">
-- Description: <description,stored procedure="" to="" create="" tables,="">
-- =============================================
alter PROCEDURE [dbo].[CreateTable]
-- Add the parameters for the stored procedure here
@databaseName nvarchar(100),
@databaseTable nvarchar(100),
@primaryKey nvarchar(100)

AS

declare @qry nvarchar(1500)

BEGIN

SELECT @qry =

'CREATE TABLE '+@databaseName +'.dbo. '+ @databaseTable +'(
[ClientCustID] [char](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerName] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Address] [varchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[City] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[State] [char](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Zip] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MailAddress] [varchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MailCity] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MailState] [char](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MailZip] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Type] [char](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ClientCoCustListID] [int] IDENTITY(1,1) NOT NULL,
[Ucode] [char](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Flag] [char](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Program_ID] [tinyint] NULL CONSTRAINT [DF_CustList_PGE051007_Program_ID] DEFAULT ((1)),
CONSTRAINT '+ @primaryKey +' PRIMARY KEY CLUSTERED
(
[ClientCoCustListID] ASC
)
) ON [PRIMARY]

'



print @qry

--To execute the query string
exec SP_Executesql @qry

END
GO

--To execute the stored procedure and create the tables

exec createTable 'CustList_PGE_0131','CustList_PGE013108','PK_CustList_PGE013108'
GeneralSaving Image Pin
mwanyu13-Feb-08 21:11
mwanyu13-Feb-08 21:11 
GeneralRe: Saving Image Pin
Giorgi Dalakishvili13-Feb-08 22:43
mentorGiorgi Dalakishvili13-Feb-08 22:43 
Generalreplace '1/1/1900' to NULL in MS SQL Pin
John Sundar13-Feb-08 20:39
John Sundar13-Feb-08 20:39 
GeneralRe: replace '1/1/1900' to NULL in MS SQL Pin
Colin Angus Mackay13-Feb-08 21:11
Colin Angus Mackay13-Feb-08 21:11 
GeneralIncluding MSSQL in a C# application for a client. Pin
AlainMesias13-Feb-08 15:51
AlainMesias13-Feb-08 15:51 
Generalcopy datarow Pin
Smithers-Jones13-Feb-08 10:01
Smithers-Jones13-Feb-08 10:01 
GeneralRe: copy datarow Pin
pmarfleet13-Feb-08 11:08
pmarfleet13-Feb-08 11:08 
GeneralRe: copy datarow Pin
Smithers-Jones13-Feb-08 11:45
Smithers-Jones13-Feb-08 11:45 
GeneralStored procedure returning dataset Pin
#realJSOP13-Feb-08 8:26
mve#realJSOP13-Feb-08 8:26 
GeneralRe: Stored procedure returning dataset Pin
pmarfleet13-Feb-08 11:07
pmarfleet13-Feb-08 11:07 
GeneralDeleting top 3 from a select [modified] Pin
Dio2213-Feb-08 7:42
Dio2213-Feb-08 7:42 
GeneralRe: Deleting top 3 from a select Pin
Dio2213-Feb-08 8:37
Dio2213-Feb-08 8:37 
QuestionBest way to store addresses ?? Pin
C. L. Phillip13-Feb-08 5:10
C. L. Phillip13-Feb-08 5:10 
GeneralRe: Best way to store addresses ?? Pin
Joe13-Feb-08 6:07
Joe13-Feb-08 6:07 
GeneralQuestion regarding ADO (not .NET) -&gt; Getting stored procedures signatures. Pin
Green Fuze13-Feb-08 5:09
Green Fuze13-Feb-08 5:09 
GeneralStored procedure Pin
new2pgrmg13-Feb-08 4:23
new2pgrmg13-Feb-08 4:23 
GeneralRe: Stored procedure Pin
andyharman13-Feb-08 4:30
professionalandyharman13-Feb-08 4:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.