Click here to Skip to main content
15,913,090 members
Home / Discussions / Database
   

Database

 
GeneralRe: how to know current date and time Pin
janani1313-Jul-09 23:26
janani1313-Jul-09 23:26 
AnswerRe: how to know current date and time Pin
Md. Marufuzzaman14-Jul-09 19:18
professionalMd. Marufuzzaman14-Jul-09 19:18 
GeneralRe: how to know current date and time Pin
ScottM115-Jul-09 2:47
ScottM115-Jul-09 2:47 
Questiondisplay exactly 2 digits after decimal point in money Pin
janani1313-Jul-09 18:59
janani1313-Jul-09 18:59 
AnswerRe: display exactly 2 digits after decimal point in money Pin
_Damian S_13-Jul-09 19:27
professional_Damian S_13-Jul-09 19:27 
AnswerRe: display exactly 2 digits after decimal point in money Pin
goodideadave14-Jul-09 7:24
goodideadave14-Jul-09 7:24 
AnswerRe: display exactly 2 digits after decimal point in money Pin
Niladri_Biswas15-Jul-09 16:00
Niladri_Biswas15-Jul-09 16:00 
Questionsqlpubwiz Command Line Issue. Pin
_Maxxx_13-Jul-09 17:33
professional_Maxxx_13-Jul-09 17:33 
I didn't know whether to reply to my original question or post new - but as the original was asked (accidentally) under a different user name, I though I'd start a new thread. Apologies to anyone offended by that. (Original Here)[^]

I have sqlpubwiz 1.3 and it fails to script correctly on SQL Server 2008 if there are any foreign keys (or other constraints).
I'm kind of assuming this is something I am doing - as it's a pretty useless tool otherwise -
I have test db with two tables
CREATE TABLE [dbo].[Table_1](
	[id] [int] NOT NULL,
	[num] [int] NULL,
 CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED 
(
	[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]

CREATE TABLE [dbo].[Table_2](
	[id] [int] NOT NULL,
	[num] [int] NULL,
 CONSTRAINT [PK_Table_2] PRIMARY KEY CLUSTERED 
(
	[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

ALTER TABLE [dbo].[Table_2]  WITH CHECK ADD  CONSTRAINT [FK_Table_2_Table_1] FOREIGN KEY([id])
REFERENCES [dbo].[Table_1] ([id])
GO

ALTER TABLE [dbo].[Table_2] CHECK CONSTRAINT [FK_Table_2_Table_1]
GO


Then I (try to) script it...

C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.2> sqlpubwiz script -d myDatabase -S localhost\MYDATABASE -f .\test.txt


and get the error...
Microsoft (R) SQL Server Database Publishing Wizard
Version 10.0.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Generating script for database stit1
- Generating script targeted for SQL Server 2005
Gathering list of objects to script
Scripting objects
.....Error: Operation is not valid due to the current state of the object.

C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.2>



Delete the foreign key and all is well.


I'd really appreciate it if someone could either confirm or deny the fact that this is 'just me' or, in fact, sqlpubwiz is a pile of donkey doo doo

___________________________________________
.\\axxx
(That's an 'M')

AnswerRe: sqlpubwiz Command Line Issue. Pin
Josh Handley13-Jul-11 0:20
Josh Handley13-Jul-11 0:20 
QuestionHelp with Built-in Database: Visual Web Developer 2008 Express Pin
pstyles113-Jul-09 5:05
pstyles113-Jul-09 5:05 
AnswerRe: Help with Built-in Database: Visual Web Developer 2008 Express Pin
_Damian S_13-Jul-09 19:32
professional_Damian S_13-Jul-09 19:32 
QuestionHelp required for CTE Pin
Zafar Sultan13-Jul-09 3:33
Zafar Sultan13-Jul-09 3:33 
QuestionGetting data related to what has been selected randomly from a database Pin
LucBite13-Jul-09 3:32
LucBite13-Jul-09 3:32 
AnswerRe: Getting data related to what has been selected randomly from a database Pin
Vimalsoft(Pty) Ltd13-Jul-09 3:59
professionalVimalsoft(Pty) Ltd13-Jul-09 3:59 
GeneralRe: Getting data related to what has been selected randomly from a database Pin
LucBite13-Jul-09 4:16
LucBite13-Jul-09 4:16 
GeneralRe: Getting data related to what has been selected randomly from a database Pin
Vimalsoft(Pty) Ltd13-Jul-09 4:32
professionalVimalsoft(Pty) Ltd13-Jul-09 4:32 
GeneralRe: Getting data related to what has been selected randomly from a database Pin
Blue_Boy13-Jul-09 4:33
Blue_Boy13-Jul-09 4:33 
GeneralRe: Getting data related to what has been selected randomly from a database Pin
DoctorMick13-Jul-09 6:13
DoctorMick13-Jul-09 6:13 
GeneralRe: Getting data related to what has been selected randomly from a database Pin
Jerry Hammond13-Jul-09 10:34
Jerry Hammond13-Jul-09 10:34 
QuestionSplitter container Pin
Isaac Gordon13-Jul-09 0:01
Isaac Gordon13-Jul-09 0:01 
AnswerRe: Splitter container Pin
Muhammad Mazhar13-Jul-09 0:43
Muhammad Mazhar13-Jul-09 0:43 
QuestionCan't save new records to the dataset - I'm practising with the binary formatter Pin
BluesEnd12-Jul-09 17:43
BluesEnd12-Jul-09 17:43 
QuestionReporting Services Pin
devvvy12-Jul-09 16:57
devvvy12-Jul-09 16:57 
Questionsql execution audit - tools? Pin
devvvy12-Jul-09 15:02
devvvy12-Jul-09 15:02 
AnswerRe: sql execution audit - tools? Pin
Niladri_Biswas13-Jul-09 16:17
Niladri_Biswas13-Jul-09 16:17 

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.