Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Logical errors


SQL Logical errors

Author
Message
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16626 Visits: 17024
sundayose (3/28/2013)
I think what I need is a tutorial which will teach me on how to join multiple table.

Most of the tutorials I am getting on the internet do not show how to deal with multiple tables like 5 or more thanks.


If you want help with this you will have to post ddl, sample data and desired results. See the first link in my signature for best practices when posting questions.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
sundayose
sundayose
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 16
How do I generate the DDL for entire my Database?

Thanks for the responses.
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16626 Visits: 17024
sundayose (3/28/2013)
How do I generate the DDL for entire my Database?

Thanks for the responses.


You don't need the entire database, just the few tables in your query.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
sundayose
sundayose
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 16
Below is the DDL for my tables.


USE [MSIU]
GO
/****** Object: Table [dbo].[tbl_DISTRIBUTOR_MASTER] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_DISTRIBUTOR_MASTER](
[int_DISTRIBUTOR_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[str_DISTRIBUTOR_CODE] [varchar](50) NULL,
[str_DISTRIBUTOR_NAME] [varchar](100) NULL,
[int_ORAGANISATION_TYPE_ID] [int] NULL,
[str_PROPRIETOR_NAME] [varchar](50) NULL,
[str_OCCUPATION] [varchar](50) NULL,
[str_DESIGNATION] [varchar](50) NULL,
[str_CONTACT_NUMBER] [varchar](50) NULL,
[str_EMAIL] [varchar](100) NULL,
[str_ACCEPTABLE_CREDIT_LIMIT] [varchar](50) NULL,
[dec_ACCEPTED_DISCOUNT] [decimal](18, 2) NULL,
[str_POSTAL_ADDRESS] [varchar](200) NULL,
[int_VILLAGE_ID] [bigint] NOT NULL,
[int_PARISH_ID] [bigint] NOT NULL,
[int_SUB_COUNTY_ID] [bigint] NOT NULL,
[int_COUNTY_ID] [bigint] NOT NULL,
[int_SUB_DISTRICT_ID] [bigint] NOT NULL,
[int_DISTRICT_ID] [bigint] NOT NULL,
[int_COUNTRY_ID] [bigint] NOT NULL,
[bln_ACTIVE] [bit] NULL,
[bln_ISDELETED] [bit] NOT NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
CONSTRAINT [PK_tbl_DISTRIBUTOR_MASTER] PRIMARY KEY CLUSTERED
(
[int_DISTRIBUTOR_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_SALES_EXECUTIVE_MASTER] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_SALES_EXECUTIVE_MASTER](
[int_SALES_EXECUTIVE_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[str_SALES_EXECUTIVE_CODE] [varchar](50) NULL,
[str_SALES_EXECUTIVE_NAME] [varchar](100) NULL,
[str_EMAIL] [varchar](100) NULL,
[str_GENDER] [varchar](50) NULL,
[str_CONTACT_NUMBER] [varchar](50) NULL,
[int_ACCEPTABLE_CREDIT_LIMIT] [int] NULL,
[str_AREA_OF_OPERATION] [varchar](50) NULL,
[int_SALES_TEAM_ID] [bigint] NULL,
[str_PHYSICAL_ADDRESS] [varchar](200) NULL,
[bln_ISACTIVE] [bit] NULL,
[bln_ISDELETED] [bit] NOT NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
[dt_BIRTH_DATE] [datetime] NULL,
CONSTRAINT [PK_tbl_SALSE_EXECUTIVE_MASTER] PRIMARY KEY CLUSTERED
(
[int_SALES_EXECUTIVE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_SALES_TEAM_MASTER] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_SALES_TEAM_MASTER](
[int_SALES_TEAM_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[str_SALES_TEAM_CODE] [varchar](50) NULL,
[str_SALES_TEAM_NAME] [varchar](100) NULL,
[str_DRIVER_NAME] [varchar](100) NULL,
[str_DESCRIPTION] [varchar](1000) NULL,
[bln_ISACTIVE] [bit] NOT NULL,
[bln_ISDELETED] [bit] NOT NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
CONSTRAINT [PK_tbl_SALES_TEAM_MASTER] PRIMARY KEY CLUSTERED
(
[int_SALES_TEAM_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_VOUCHER_CAPTURE] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_VOUCHER_CAPTURE](
[int_VOUCHER_CAPTURE_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[int_SALES_TEAM_ID] [bigint] NULL,
[int_SALES_EXECUTIVE_ID] [bigint] NULL,
[int_DISTRIBUTOR_ID] [bigint] NULL,
[dt_VOUCHER_ISSUE_DATE] [datetime] NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
[int_SALES_AMOUNT] [decimal](18, 2) NULL,
CONSTRAINT [PK_tbl_VOUCHER_CAPTURE] PRIMARY KEY CLUSTERED
(
[int_VOUCHER_CAPTURE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_VOUCHER_CAPTURE_DETAIL] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_VOUCHER_CAPTURE_DETAIL](
[int_VOUCHER_CAPTURE_DETAIL_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[int_VOUCHER_CAPTURE_ID] [bigint] NOT NULL,
[int_SEQ_NO] [bigint] NULL,
[int_BARCODE_DETAIL_ID] [bigint] NOT NULL,
[int_BARCODE_ID] [bigint] NOT NULL,
[int_VOUCHER_ISSUE_ID] [bigint] NOT NULL,
[int_VOUCHER_ISSUE_DETAIL_ID] [bigint] NOT NULL,
[dt_APPLICABLE_FROM] [datetime] NULL,
[int_VOUCHER_NUMBER] [int] NULL,
[str_BARCODE] [varchar](15) NULL,
[int_STATUS] [int] NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
[bln_ISDELETE] [bit] NULL,
[int_PROJECT_TYPE] [int] NULL,
CONSTRAINT [PK_tbl_VOUCHER_CAPTURE_DETAIL] PRIMARY KEY CLUSTERED
(
[int_VOUCHER_CAPTURE_DETAIL_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_VOUCHER_ISSUE] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_VOUCHER_ISSUE](
[int_VOUCHER_ISSUE_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[int_SALES_TEAM_ID] [bigint] NULL,
[dt_VOUCHER_ISSUE_DATE] [datetime] NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
CONSTRAINT [PK_tbl_VOUCHER_ISSUE] PRIMARY KEY CLUSTERED
(
[int_VOUCHER_ISSUE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tbl_VOUCHER_ISSUE_DETAIL] Script Date: 3/28/2013 7:23:14 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_VOUCHER_ISSUE_DETAIL](
[int_VOUCHER_ISSUE_DETAIL_ID] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[int_VOUCHER_ISSUE_ID] [bigint] NOT NULL,
[int_SEQ_NO] [bigint] NULL,
[int_BARCODE_DETAIL_ID] [bigint] NOT NULL,
[int_BARCODE_ID] [bigint] NOT NULL,
[dt_APPLICABLE_FROM] [datetime] NULL,
[int_VOUCHER_NUMBER] [int] NULL,
[str_BARCODE] [varchar](15) NULL,
[int_STATUS] [int] NULL,
[int_DISTRIBUTOR_ID] [bigint] NOT NULL,
[str_CREATED_BY] [varchar](50) NULL,
[dt_CREATED_DATE] [datetime] NULL,
[str_UPDATED_BY] [varchar](50) NULL,
[dt_UPDATED_DATE] [datetime] NULL,
[bln_ISDELETE] [bit] NULL,
[int_PROJECT_TYPE] [int] NULL,
CONSTRAINT [PK_tbl_VOUCHER_ISSUE_DETAIL] PRIMARY KEY CLUSTERED
(
[int_VOUCHER_ISSUE_DETAIL_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_VILLAGE_ID] DEFAULT ((0)) FOR [int_VILLAGE_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_PARISH_ID] DEFAULT ((0)) FOR [int_PARISH_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_SUB_COUNTY_ID] DEFAULT ((0)) FOR [int_SUB_COUNTY_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_COUNTY_ID] DEFAULT ((0)) FOR [int_COUNTY_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_SUB_DISTRICT_ID] DEFAULT ((0)) FOR [int_SUB_DISTRICT_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_DISTRICT_ID] DEFAULT ((0)) FOR [int_DISTRICT_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_int_COUNTRY_ID] DEFAULT ((0)) FOR [int_COUNTRY_ID]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_bln_ACTIVE] DEFAULT ((1)) FOR [bln_ACTIVE]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] ADD CONSTRAINT [DF_tbl_DISTRIBUTOR_MASTER_bln_ISDELETED] DEFAULT ((0)) FOR [bln_ISDELETED]
GO
ALTER TABLE [dbo].[tbl_SALES_EXECUTIVE_MASTER] ADD CONSTRAINT [DF_tbl_SALSE_EXECUTIVE_MASTER_bln_ISACTIVE] DEFAULT ((1)) FOR [bln_ISACTIVE]
GO
ALTER TABLE [dbo].[tbl_SALES_EXECUTIVE_MASTER] ADD CONSTRAINT [DF_tbl_SALSE_EXECUTIVE_MASTER_bln_ISDELETED] DEFAULT ((0)) FOR [bln_ISDELETED]
GO
ALTER TABLE [dbo].[tbl_SALES_TEAM_MASTER] ADD CONSTRAINT [DF_tbl_SALES_TEAM_MASTER_bln_ISDELETED1] DEFAULT ((1)) FOR [bln_ISACTIVE]
GO
ALTER TABLE [dbo].[tbl_SALES_TEAM_MASTER] ADD CONSTRAINT [DF_tbl_SALES_TEAM_MASTER_bln_ISDELETED] DEFAULT ((0)) FOR [bln_ISDELETED]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE_DETAIL] ADD CONSTRAINT [DF_tbl_VOUCHER_CAPTURE_DETAIL_bln_ISDELETE] DEFAULT ((0)) FOR [bln_ISDELETE]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_ISSUE_DETAIL] ADD CONSTRAINT [DF_Table_1_int_CLIENT_ID] DEFAULT ((0)) FOR [int_DISTRIBUTOR_ID]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_ISSUE_DETAIL] ADD CONSTRAINT [DF_tbl_VOUCHER_ISSUE_DETAIL_bln_ISDELETE] DEFAULT ((0)) FOR [bln_ISDELETE]
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] WITH CHECK ADD CONSTRAINT [FK_tbl_DISTRIBUTOR_MASTER_tbl_VILLAGE_MASTER] FOREIGN KEY([int_VILLAGE_ID])
REFERENCES [dbo].[tbl_VILLAGE_MASTER] ([int_VILLAGE_ID])
GO
ALTER TABLE [dbo].[tbl_DISTRIBUTOR_MASTER] CHECK CONSTRAINT [FK_tbl_DISTRIBUTOR_MASTER_tbl_VILLAGE_MASTER]
GO
ALTER TABLE [dbo].[tbl_SALES_EXECUTIVE_MASTER] WITH CHECK ADD CONSTRAINT [FK_tbl_SALES_EXECUTIVE_MASTER_tbl_SALES_TEAM_MASTER] FOREIGN KEY([int_SALES_TEAM_ID])
REFERENCES [dbo].[tbl_SALES_TEAM_MASTER] ([int_SALES_TEAM_ID])
GO
ALTER TABLE [dbo].[tbl_SALES_EXECUTIVE_MASTER] CHECK CONSTRAINT [FK_tbl_SALES_EXECUTIVE_MASTER_tbl_SALES_TEAM_MASTER]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE] WITH CHECK ADD CONSTRAINT [FK_tbl_VOUCHER_CAPTURE_tbl_DISTRIBUTOR_MASTER] FOREIGN KEY([int_DISTRIBUTOR_ID])
REFERENCES [dbo].[tbl_DISTRIBUTOR_MASTER] ([int_DISTRIBUTOR_ID])
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE] CHECK CONSTRAINT [FK_tbl_VOUCHER_CAPTURE_tbl_DISTRIBUTOR_MASTER]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE] WITH CHECK ADD CONSTRAINT [FK_tbl_VOUCHER_CAPTURE_tbl_SALES_EXECUTIVE_MASTER] FOREIGN KEY([int_SALES_EXECUTIVE_ID])
REFERENCES [dbo].[tbl_SALES_EXECUTIVE_MASTER] ([int_SALES_EXECUTIVE_ID])
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE] CHECK CONSTRAINT [FK_tbl_VOUCHER_CAPTURE_tbl_SALES_EXECUTIVE_MASTER]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE] WITH CHECK ADD CONSTRAINT [FK_tbl_VOUCHER_CAPTURE_tbl_SALES_TEAM_MASTER] FOREIGN KEY([int_SALES_TEAM_ID])
REFERENCES [dbo].[tbl_SALES_TEAM_MASTER] ([int_SALES_TEAM_ID])
GO
ALTER TABLE [dbo].[tbl_VOUCHER_CAPTURE] CHECK CONSTRAINT [FK_tbl_VOUCHER_CAPTURE_tbl_SALES_TEAM_MASTER]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_ISSUE] WITH CHECK ADD CONSTRAINT [FK_tbl_VOUCHER_ISSUE_tbl_SALES_TEAM_MASTER] FOREIGN KEY([int_SALES_TEAM_ID])
REFERENCES [dbo].[tbl_SALES_TEAM_MASTER] ([int_SALES_TEAM_ID])
GO
ALTER TABLE [dbo].[tbl_VOUCHER_ISSUE] CHECK CONSTRAINT [FK_tbl_VOUCHER_ISSUE_tbl_SALES_TEAM_MASTER]
GO
ALTER TABLE [dbo].[tbl_VOUCHER_ISSUE_DETAIL] WITH CHECK ADD CONSTRAINT [FK_tbl_VOUCHER_ISSUE_DETAIL_tbl_BARCODE_DETAIL] FOREIGN KEY([int_BARCODE_DETAIL_ID])
REFERENCES [dbo].[tbl_BARCODE_DETAIL] ([int_BARCODE_DETAIL_ID])
GO
ALTER TABLE [dbo].[tbl_VOUCHER_ISSUE_DETAIL] CHECK CONSTRAINT [FK_tbl_VOUCHER_ISSUE_DETAIL_tbl_BARCODE_DETAIL]
GO
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16626 Visits: 17024
That was pretty close. There are a few foreign keys to tables we don't have but that is workable. We are still missing tbl_DISTRICT_MASTER. And more importantly we still don't have any data to work with.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
OTF
OTF
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 4128
Just something else you can also do if joining that many tables is all new to you.
You can join say the first two tables then check the output and then another and then check again until you
spot the join that is introducing the duplicates/rows you want excluded.
This would also give you some understanding of the data you are querying which is also what appears to be lacking here.
If you are, however, able to provide data which would be representative of the problem you are actually having then, of course, as has already been suggested go ahead and do so.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search