Showing posts with label text. Show all posts
Showing posts with label text. Show all posts

Wednesday, March 28, 2012

how to create pages on-the-fly

Hi,
Its a simple requirement but i have failed to figure it out.
I have a Report.rpt file which is printing some text inputted by the user and it is going to print the number of copy of the pages (like "Page N of M" in crystal report) which is also given by the user.

i.e. if the user inputs 3 as the number of copy it is going to print, the Report needs to be build with creating 3 pages and following text needs to be there :
Page 1 of 3
Page 2 of 3
Page 3 of 3

The problem is to create these 3 pages in the report.

There is no group inserted and connection with any source. Only the text value and the value for the number of pages send from VB6.

I could have send the report to the printer M# of times, depending on the value of M given by the user But it is not a good one and i also need to give the option to choose the printer to the user (crxRpt.PrinterSetup 0 ). And that solution is going to ask to choose the printer for each page.

May be its a dump question but i am in pain. Please think for a while to help me out.

Regards
-JoyshimaWhy do you want to do this?
I dont think this is possible
Can you explain more?|||Thanks for your responce. I was waiting for you.

I am doing it for a nursing home and they need to take print out of some kind of header card. Lets say they need to print 3 header card and they will be as follows :

------
Header 1 of 3
XXXXXX
------

------
Header 2 of 3
XXXXXX
------

------
Header 3 of 3
XXXXXX
------

So the input is the total number of the header card and the text they want to be printed on it. Also I need to give them the option to choose the printer before printing and number of copies they want.

Please suggest me something for it.|||Instead of Page 1 of 3 do you want to show it as header 1 of 3?|||"Page 1 of 3" or "Header 1 of 3" that text is not the problem. The problem is to create that 3 pages according to users input.

I have created two parameter on which i am sending (from VB6) the value for the text "XXXXXX" and the value that the user inputs (i.e. for the example it is 3).

Now with this information i need to create the pages (i.e. 3 page) and print the text and the header/Page text.

Any idea? how can i?|||You need to have a table having these information
Text
Header

When user inputs those say "XXXXXXX" and 3, insert three records to that table having
XXXXXXX header 1 of 3
XXXXXXX header 2 of 3
XXXXXXX header 3 of 3

Now design a report based on this table
Group it by first column
Right click on Group header and select Section Expert
Check the check box, "New Page After"

Try it and see what happens|||Yes Madhi, I have done this to give the solution, but couldn't like that. For a small amount of data you need to carry a database and table - too much heavy. And also it is simple task to print some text on page.

Is it possible to create recordset without any table from VB6? If i can put the data as three record inside that recordset and send it to the report file (rpt file), i may be able to have three pages from it.

Therefore the three record on the recordset would be :
XXXXXXX header 1 of 3
XXXXXXX header 2 of 3
XXXXXXX header 3 of 3
This is only my idea. Let me know your opinion.
-Joyshima|||I am not sure about your point

See if this supports your point
http://support.businessobjects.com/library/kbase/articles/c2011950.asp

Monday, March 26, 2012

How to create full text index by SQL Server Express?

Hi all..

I tried too much to create FULL TEXT INDEX by using SQL Server 2005 Management Studio Express, it returns this ERR MSG:

Informational: No full-text supported languages found.

Informational: No full-text supported languages found.

Msg 7680, Level 16, State 1, Line 1

Default full-text index language is not a language supported by full-text search

This problem dos not come when I use Microsoft SQL Server 2005 Management Studio, to create FULL TEXT INDEX!

My DB collation is: "Arabic_CI_AS"

But I don’t need this, I can use English Language.

Please, what can I do?

Full Text Indexing is not available in the 'basic' SQL Server 2005 Express.

You must download and install SQL Server 2005 Express Edition with Advanced Services.

Overview

Microsoft SQL Server 2005 Express Edition with Advanced Services (SQL Server Express) is a new, free, easy-to-use version of SQL Server Express that includes a new graphical management tool and powerful features for reporting and advanced text-based searches. SQL Server Express provides powerful and reliable data management tools and rich features, data protection, and fast performance. It is ideal for embedded application clients, light Web applications, and local data stores.

SQL Server Express with Advanced Services has all of the features in SQL Server 2005 Express Edition, plus you can:

Easily manage and administer SQL Server Express with a new easy-to-use graphical management tool -- SQL Server 2005 Management Studio Express (SSMSE).

Issue full-text queries against plain character-based data in SQL Server tables. Full-text queries can include words and phrases, or multiple forms of a word or phrase.

Run SQL Server Reporting Services reports on local relational data.|||

Of course I'm using sql server with advanced edition, and this problem appears only with it, you may see this URL:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1109200&SiteID=1

In that URL there is no correct answer, so he changed his mind, and as I think, decided to use SQL- Server 2005 Trial instead of (SQL SERVER EXPRESS ADV).

However; as we (me & my friend Ibrahim) understood this ERR message:

Informational: No full-text supported languages found.

Informational: No full-text supported languages found.

Msg 7680, Level 16, State 1, Line 1

Default full-text index language is not a language supported by full-text search

My friend thought that the correct question is about: how to add languages to support full-text, so he wrote the other question as a correction to this one, not as a repetition.

Thank you very much.

|||


See the follwing links for clarification:

default full-text language Option
"The default value of this option is the language of the server."
http://msdn2.microsoft.com/en-us/library/ms180854.aspx

Setting Server Configuration Options

http://msdn2.microsoft.com/en-us/library/ms189631.aspx


sys.fulltext_languages (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms176076.aspx

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Hi…

When I execute this query:

select * from sys.fulltext_languages

It returns 0 rows, nothing…

Also when I tried to update sys.fulltext_languages or sys.configurations by using UPDATE or sp_configure it returns this msg:

Ad hoc update to system catalogs is not supported

Also when I tried to enable 'allow updates' it returns same error msg.

Any way, thank you so much…

I will buy SQL Server 2005 Developer edition.

Thank you.

sql

How to create file using field from a table.

I am using SQL 8.0 and have the challenge of writing text files from a table.
My table contains three fields, file name, file data, and an index. I need to
create a file for every row that uses the 1st field as the file name, which
is already in the correct format [filename.txt] and I need the value from the
second column, filed data, to be the text within the text file.
Can anyone assit me in creating these files? I cannot find anything to
assist me with this in the online books nor MSDN.
You can use this demo code as a start:
-- OJ: TEXTCOPY example
-- Loading files into db &
-- exporting files out to folder
--
--TEXTCOPY IN
--create tb to hold data
create table tmp(fname varchar(100),img image default '0x0')
go
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass'
--specify desired folder
set @.path='c:\winnt\'
set @.sql='dir ' + @.path + '*.bmp /c /b'
--insert filenames into tb
insert tmp(fname)
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /i' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
go
select * from tmp
go
--TEXTCOPY OUT
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass,'
--specify desired output folder
set @.path='c:\tmp\'
set @.sql='md ' + @.path
--create output folder
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /o' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
set @.sql='dir ' + @.path + '*.bmp /c /b'
exec master..xp_cmdshell @.sql
go
drop table tmp
go
"Dorian Foster" <DorianFoster@.discussions.microsoft.com> wrote in message
news:94D63419-1F96-4437-A07E-C293141D84C8@.microsoft.com...
> I am using SQL 8.0 and have the challenge of writing text files from a
table.
> My table contains three fields, file name, file data, and an index. I need
to
> create a file for every row that uses the 1st field as the file name,
which
> is already in the correct format [filename.txt] and I need the value from
the
> second column, filed data, to be the text within the text file.
> Can anyone assit me in creating these files? I cannot find anything to
> assist me with this in the online books nor MSDN.
|||Refer to Books Online; search for "Write File Transformation"
"Dorian Foster" wrote:

> I am using SQL 8.0 and have the challenge of writing text files from a table.
> My table contains three fields, file name, file data, and an index. I need to
> create a file for every row that uses the 1st field as the file name, which
> is already in the correct format [filename.txt] and I need the value from the
> second column, filed data, to be the text within the text file.
> Can anyone assit me in creating these files? I cannot find anything to
> assist me with this in the online books nor MSDN.

How to create file using field from a table.

I am using SQL 8.0 and have the challenge of writing text files from a table
.
My table contains three fields, file name, file data, and an index. I need t
o
create a file for every row that uses the 1st field as the file name, which
is already in the correct format [filename.txt] and I need the value fro
m the
second column, filed data, to be the text within the text file.
Can anyone assit me in creating these files? I cannot find anything to
assist me with this in the online books nor MSDN.You can use this demo code as a start:
-- OJ: TEXTCOPY example
-- Loading files into db &
-- exporting files out to folder
--
--TEXTCOPY IN
--
--create tb to hold data
create table tmp(fname varchar(100),img image default '0x0')
go
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass'
--specify desired folder
set @.path='c:\winnt'
set @.sql='dir ' + @.path + '*.bmp /c /b'
--insert filenames into tb
insert tmp(fname)
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /i' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
go
select * from tmp
go
--
--TEXTCOPY OUT
--
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass,'
--specify desired output folder
set @.path='c:\tmp'
set @.sql='md ' + @.path
--create output folder
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /o' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
set @.sql='dir ' + @.path + '*.bmp /c /b'
exec master..xp_cmdshell @.sql
go
drop table tmp
go
"Dorian Foster" <DorianFoster@.discussions.microsoft.com> wrote in message
news:94D63419-1F96-4437-A07E-C293141D84C8@.microsoft.com...
> I am using SQL 8.0 and have the challenge of writing text files from a
table.
> My table contains three fields, file name, file data, and an index. I need
to
> create a file for every row that uses the 1st field as the file name,
which
> is already in the correct format [filename.txt] and I need the value from[/vbc
ol]
the[vbcol=seagreen]
> second column, filed data, to be the text within the text file.
> Can anyone assit me in creating these files? I cannot find anything to
> assist me with this in the online books nor MSDN.|||Refer to Books Online; search for "Write File Transformation"
"Dorian Foster" wrote:

> I am using SQL 8.0 and have the challenge of writing text files from a tab
le.
> My table contains three fields, file name, file data, and an index. I need
to
> create a file for every row that uses the 1st field as the file name, whic
h
> is already in the correct format [filename.txt] and I need the value f
rom the
> second column, filed data, to be the text within the text file.
> Can anyone assit me in creating these files? I cannot find anything to
> assist me with this in the online books nor MSDN.

How to create file using field from a table.

I am using SQL 8.0 and have the challenge of writing text files from a table.
My table contains three fields, file name, file data, and an index. I need to
create a file for every row that uses the 1st field as the file name, which
is already in the correct format [filename.txt] and I need the value from the
second column, filed data, to be the text within the text file.
Can anyone assit me in creating these files? I cannot find anything to
assist me with this in the online books nor MSDN.You can use this demo code as a start:
-- OJ: TEXTCOPY example
-- Loading files into db &
-- exporting files out to folder
--
--
--TEXTCOPY IN
--
--create tb to hold data
create table tmp(fname varchar(100),img image default '0x0')
go
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass'
--specify desired folder
set @.path='c:\winnt\'
set @.sql='dir ' + @.path + '*.bmp /c /b'
--insert filenames into tb
insert tmp(fname)
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /i' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
go
select * from tmp
go
--
--TEXTCOPY OUT
--
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass,'
--specify desired output folder
set @.path='c:\tmp\'
set @.sql='md ' + @.path
--create output folder
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /o' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
set @.sql='dir ' + @.path + '*.bmp /c /b'
exec master..xp_cmdshell @.sql
go
drop table tmp
go
"Dorian Foster" <DorianFoster@.discussions.microsoft.com> wrote in message
news:94D63419-1F96-4437-A07E-C293141D84C8@.microsoft.com...
> I am using SQL 8.0 and have the challenge of writing text files from a
table.
> My table contains three fields, file name, file data, and an index. I need
to
> create a file for every row that uses the 1st field as the file name,
which
> is already in the correct format [filename.txt] and I need the value from
the
> second column, filed data, to be the text within the text file.
> Can anyone assit me in creating these files? I cannot find anything to
> assist me with this in the online books nor MSDN.|||Refer to Books Online; search for "Write File Transformation"
"Dorian Foster" wrote:
> I am using SQL 8.0 and have the challenge of writing text files from a table.
> My table contains three fields, file name, file data, and an index. I need to
> create a file for every row that uses the 1st field as the file name, which
> is already in the correct format [filename.txt] and I need the value from the
> second column, filed data, to be the text within the text file.
> Can anyone assit me in creating these files? I cannot find anything to
> assist me with this in the online books nor MSDN.

Monday, March 19, 2012

How to create a RTF field ?

How can I save the text of a rich text box in a sql express 2005 datatable ?

Of course I'd like to save the string and the format of the text (bold, color etc...).

Which column type I have to use for this RTF field ?

Thank you.

hi,

I'd guess nvarchar(MAX)

this data type can host up to 2gb of text data, in national format thus including chars other than the ones present in the traditional alphabet, like chinese, cyrillic and the like..
http://msdn2.microsoft.com/en-us/library/a1904w6t.aspx
http://msdn2.microsoft.com/en-us/library/ms186939.aspx

http://msdn2.microsoft.com/en-us/library/ms187752.aspx for the complete list of supprted data types..

regards

|||

hi,

Thank you for your response.

In fact, my problem was I directly bind the text property and not the Rtf property of my rich text box to the sql field.

It's strange that the Rtf property is not available for binding in the designer so I have to code the binding !

Me.RichTextBox1.DataBindings.Add(New System.Windows.Forms.Binding("Rtf", Me.TbTextBindingSource, "colText", True))

But now it's working !

regards

Monday, March 12, 2012

How to create a full text search in DB.

Hi everibody.

My name is Ivan and I am from Slovakia.

I would like to ask you all for helping me in creating a full text search in database.

I am working in Visual Web Developer 2005.

I have a simple table in wich i have this atributes: ID, NAME, DESCRIPTION, CONTENT

I would like to use the search for this:

When I write down for example a NAME to a textarea (whatever else it can be), I need to get back the information about the ID of the apropriate NAME.

I would really appreciate your help here.

Please can you send me a mail with the solution or any help on ivoporsche@.szm.sk

Thank you very much in advance.

Try the link below for a tutorial on Full text search in SQL Server. Hope this helps.

http://www.databasejournal.com/features/mssql/article.php/3454281

Friday, March 9, 2012

How to create a Database in SQL 2005 by using a txt file.

Good morning - I have a text file with the information on how to create a
database, the relationship between tables, etc. I am new to SQL 2005. What
I would like to do is to create the database and structure by using this
following file (MYFILE.SQL) as described below.
How can I do this?
Thank you in advance for your assistance.
CREATE TABLE [dbo].[DEPT] (
[Dept_ID] [numeric](10, 0) NOT NULL ,
[DeptName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ShortCutName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PART] (
[Part_ID] [numeric](10, 0) NOT NULL ,
[PartName] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[PartFriendlyName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL ,
[GreenDays] [smallint] NOT NULL ,
[YellowDays] [smallint] NOT NULL ,
[RedDays] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTDEPT] (
[PartDept_ID] [numeric](10, 0) NOT NULL ,
[Part_ID] [numeric](10, 0) NOT NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[ProcessOrder] [int] NOT NULL ,
[CompletesProcess] [bit] NOT NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTDETAILLOG] (
[PartDetailLog_ID] [numeric](10, 0) NOT NULL ,
[PartMainLog_ID] [numeric](10, 0) NOT NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[PartDept_ID] [numeric](10, 0) NOT NULL ,
[StartTime] [smalldatetime] NOT NULL ,
[CompleteTime] [smalldatetime] NULL ,
[Notes] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTINSTRUCT] (
[PartInstruct_ID] [numeric](10, 0) NOT NULL ,
[Part_ID] [numeric](10, 0) NOT NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[StepName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[StepValue] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[StepNumber] [smallint] NOT NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL ,
[ImageFTPAddress] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[OperShowImage] [bit] NOT NULL ,
[FTPPostedDate] [smalldatetime] NULL ,
[ExtInstructionText] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTMAINLOG] (
[PartMainLog_ID] [numeric](10, 0) NOT NULL ,
[Part_ID] [numeric](10, 0) NOT NULL ,
[SerialNum] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[PartCompleted] [smalldatetime] NULL ,
[Notes] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[REJECT] (
[Reject_ID] [numeric](10, 0) NOT NULL ,
[DateOfReject] [smalldatetime] NOT NULL ,
[Part_ID] [numeric](10, 0) NULL ,
[Dept_ID] [numeric](10, 0) NULL ,
[RootCause_ID] [numeric](10, 0) NOT NULL ,
[EnteredBy] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Notes] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SerialNum] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Revision] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[ROOTCAUSE] (
[RootCause_ID] [numeric](10, 0) NOT NULL ,
[RootCauseName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[RootCauseDate] [smalldatetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DEPT] WITH NOCHECK ADD
CONSTRAINT [PK_DEPT] PRIMARY KEY CLUSTERED
(
[Dept_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PART] WITH NOCHECK ADD
CONSTRAINT [PK_PART] PRIMARY KEY CLUSTERED
(
[Part_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTDEPT] WITH NOCHECK ADD
CONSTRAINT [PK_PARTDEPT] PRIMARY KEY CLUSTERED
(
[PartDept_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTDETAILLOG] WITH NOCHECK ADD
CONSTRAINT [PK_PARTDETAILLOG] PRIMARY KEY CLUSTERED
(
[PartDetailLog_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTINSTRUCT] WITH NOCHECK ADD
CONSTRAINT [PK_PARTINSTRUCT] PRIMARY KEY CLUSTERED
(
[PartInstruct_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTMAINLOG] WITH NOCHECK ADD
CONSTRAINT [PK_PARTMAINLOG] PRIMARY KEY CLUSTERED
(
[PartMainLog_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[REJECT] WITH NOCHECK ADD
CONSTRAINT [PK_REJECT] PRIMARY KEY CLUSTERED
(
[Reject_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ROOTCAUSE] WITH NOCHECK ADD
CONSTRAINT [PK_ROOTCAUSE] PRIMARY KEY CLUSTERED
(
[RootCause_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DEPT] ADD
CONSTRAINT [DF_DEPT_DateAdded] DEFAULT (getdate()) FOR [DateAdded]
GO
ALTER TABLE [dbo].[PART] ADD
CONSTRAINT [DF_PART_DateAdded] DEFAULT (getdate()) FOR [DateAdded]
GO
ALTER TABLE [dbo].[PARTDEPT] ADD
CONSTRAINT [DF_PARTDEPT_CompletesProcess] DEFAULT (0) FOR [CompletesProcess],
CONSTRAINT [DF_PARTDEPT_DateAdded] DEFAULT (getdate()) FOR [DateAdded]
GO
ALTER TABLE [dbo].[PARTDETAILLOG] ADD
CONSTRAINT [DF_PARTDETAILLOG_StartTime] DEFAULT (getdate()) FOR [StartTime]
GO
ALTER TABLE [dbo].[PARTINSTRUCT] ADD
CONSTRAINT [DF_PARTINSTRUCT_DateAdded] DEFAULT (getdate()) FOR [DateAdded],
CONSTRAINT [DF_PARTINSTRUCT_OperShowImage] DEFAULT (1) FOR [OperShowImage]
GO
ALTER TABLE [dbo].[PARTMAINLOG] ADD
CONSTRAINT [DF_PARTMAINLOG_DateAdded] DEFAULT (getdate()) FOR [DateAdded]
GO
ALTER TABLE [dbo].[ROOTCAUSE] ADD
CONSTRAINT [DF_ROOTCAUSE_RootCauseDate] DEFAULT (getdate()) FOR
[RootCauseDate]
GO
ALTER TABLE [dbo].[PARTDEPT] ADD
CONSTRAINT [FK_PARTDEPT_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_PARTDEPT_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
)
GO
ALTER TABLE [dbo].[PARTDETAILLOG] ADD
CONSTRAINT [FK_PARTDETAILLOG_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_PARTDETAILLOG_PARTMAINLOG] FOREIGN KEY
(
[PartMainLog_ID]
) REFERENCES [dbo].[PARTMAINLOG] (
[PartMainLog_ID]
)
GO
ALTER TABLE [dbo].[PARTINSTRUCT] ADD
CONSTRAINT [FK_PARTINSTRUCT_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_PARTINSTRUCT_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
)
GO
ALTER TABLE [dbo].[PARTMAINLOG] ADD
CONSTRAINT [FK_PARTMAINLOG_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
)
GO
ALTER TABLE [dbo].[REJECT] ADD
CONSTRAINT [FK_REJECT_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_REJECT_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
),
CONSTRAINT [FK_REJECT_ROOTCAUSE] FOREIGN KEY
(
[RootCause_ID]
) REFERENCES [dbo].[ROOTCAUSE] (
[RootCause_ID]
)
GO
ALTER TABLE [dbo].[ROOTCAUSE] ADD
CONSTRAINT [FK_ROOTCAUSE_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
)
GODMI wrote:
> Good morning - I have a text file with the information on how to create a
> database, the relationship between tables, etc. I am new to SQL 2005. What
> I would like to do is to create the database and structure by using this
> following file (MYFILE.SQL) as described below.
> How can I do this?
>
Launch Management Studio, then do File -> Open -> File, navigate to your
MYFILE.SQL, load it, then click Execute

How to create a Database in SQL 2005 by using a txt file.

DMI wrote:
> Good morning - I have a text file with the information on how to create a
> database, the relationship between tables, etc. I am new to SQL 2005. Wh
at
> I would like to do is to create the database and structure by using this
> following file (MYFILE.SQL) as described below.
> How can I do this?
>
Launch Management Studio, then do File -> Open -> File, navigate to your
MYFILE.SQL, load it, then click ExecuteGood morning - I have a text file with the information on how to create a
database, the relationship between tables, etc. I am new to SQL 2005. What
I would like to do is to create the database and structure by using this
following file (MYFILE.SQL) as described below.
How can I do this?
Thank you in advance for your assistance.
CREATE TABLE [dbo].[DEPT] (
[Dept_ID] [numeric](10, 0) NOT NULL ,
[DeptName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT N
ULL ,
[ShortCutName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS N
OT NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PART] (
[Part_ID] [numeric](10, 0) NOT NULL ,
[PartName] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT N
ULL ,
[PartFriendlyName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI
_AS NOT
NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL ,
[GreenDays] [smallint] NOT NULL ,
[YellowDays] [smallint] NOT NULL ,
[RedDays] [smallint] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTDEPT] (
[PartDept_ID] [numeric](10, 0) NOT NULL ,
[Part_ID] [numeric](10, 0) NOT NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[ProcessOrder] [int] NOT NULL ,
[CompletesProcess] [bit] NOT NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTDETAILLOG] (
[PartDetailLog_ID] [numeric](10, 0) NOT NULL ,
[PartMainLog_ID] [numeric](10, 0) NOT NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[PartDept_ID] [numeric](10, 0) NOT NULL ,
[StartTime] [smalldatetime] NOT NULL ,
[CompleteTime] [smalldatetime] NULL ,
[Notes] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTINSTRUCT] (
[PartInstruct_ID] [numeric](10, 0) NOT NULL ,
[Part_ID] [numeric](10, 0) NOT NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[StepName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT N
ULL ,
[StepValue] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[StepNumber] [smallint] NOT NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL ,
[ImageFTPAddress] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_
AS NULL ,
[OperShowImage] [bit] NOT NULL ,
[FTPPostedDate] [smalldatetime] NULL ,
[ExtInstructionText] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NUL
L
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[PARTMAINLOG] (
[PartMainLog_ID] [numeric](10, 0) NOT NULL ,
[Part_ID] [numeric](10, 0) NOT NULL ,
[SerialNum] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[PartCompleted] [smalldatetime] NULL ,
[Notes] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DateAdded] [smalldatetime] NOT NULL ,
[LastUpdated] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[REJECT] (
[Reject_ID] [numeric](10, 0) NOT NULL ,
[DateOfReject] [smalldatetime] NOT NULL ,
[Part_ID] [numeric](10, 0) NULL ,
[Dept_ID] [numeric](10, 0) NULL ,
[RootCause_ID] [numeric](10, 0) NOT NULL ,
[EnteredBy] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
,
[Notes] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SerialNum] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
,
[Revision] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[ROOTCAUSE] (
[RootCause_ID] [numeric](10, 0) NOT NULL ,
[RootCauseName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT
NULL ,
[Dept_ID] [numeric](10, 0) NOT NULL ,
[RootCauseDate] [smalldatetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DEPT] WITH NOCHECK ADD
CONSTRAINT [PK_DEPT] PRIMARY KEY CLUSTERED
(
[Dept_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PART] WITH NOCHECK ADD
CONSTRAINT [PK_PART] PRIMARY KEY CLUSTERED
(
[Part_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTDEPT] WITH NOCHECK ADD
CONSTRAINT [PK_PARTDEPT] PRIMARY KEY CLUSTERED
(
[PartDept_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTDETAILLOG] WITH NOCHECK ADD
CONSTRAINT [PK_PARTDETAILLOG] PRIMARY KEY CLUSTERED
(
[PartDetailLog_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTINSTRUCT] WITH NOCHECK ADD
CONSTRAINT [PK_PARTINSTRUCT] PRIMARY KEY CLUSTERED
(
[PartInstruct_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PARTMAINLOG] WITH NOCHECK ADD
CONSTRAINT [PK_PARTMAINLOG] PRIMARY KEY CLUSTERED
(
[PartMainLog_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[REJECT] WITH NOCHECK ADD
CONSTRAINT [PK_REJECT] PRIMARY KEY CLUSTERED
(
[Reject_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ROOTCAUSE] WITH NOCHECK ADD
CONSTRAINT [PK_ROOTCAUSE] PRIMARY KEY CLUSTERED
(
[RootCause_ID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DEPT] ADD
CONSTRAINT [DF_DEPT_DateAdded] DEFAULT (getdate()) FOR [DateAdded]
GO
ALTER TABLE [dbo].[PART] ADD
CONSTRAINT [DF_PART_DateAdded] DEFAULT (getdate()) FOR [DateAdded]
GO
ALTER TABLE [dbo].[PARTDEPT] ADD
CONSTRAINT [DF_PARTDEPT_CompletesProcess] DEFAULT (0) FOR [Completes
Process],
CONSTRAINT [DF_PARTDEPT_DateAdded] DEFAULT (getdate()) FOR [DateAdde
d]
GO
ALTER TABLE [dbo].[PARTDETAILLOG] ADD
CONSTRAINT [DF_PARTDETAILLOG_StartTime] DEFAULT (getdate()) FOR [Sta
rtTime]
GO
ALTER TABLE [dbo].[PARTINSTRUCT] ADD
CONSTRAINT [DF_PARTINSTRUCT_DateAdded] DEFAULT (getdate()) FOR [Date
Added],
CONSTRAINT [DF_PARTINSTRUCT_OperShowImage] DEFAULT (1) FOR [OperShow
Image]
GO
ALTER TABLE [dbo].[PARTMAINLOG] ADD
CONSTRAINT [DF_PARTMAINLOG_DateAdded] DEFAULT (getdate()) FOR [DateA
dded]
GO
ALTER TABLE [dbo].[ROOTCAUSE] ADD
CONSTRAINT [DF_ROOTCAUSE_RootCauseDate] DEFAULT (getdate()) FOR
[RootCauseDate]
GO
ALTER TABLE [dbo].[PARTDEPT] ADD
CONSTRAINT [FK_PARTDEPT_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_PARTDEPT_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
)
GO
ALTER TABLE [dbo].[PARTDETAILLOG] ADD
CONSTRAINT [FK_PARTDETAILLOG_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_PARTDETAILLOG_PARTMAINLOG] FOREIGN KEY
(
[PartMainLog_ID]
) REFERENCES [dbo].[PARTMAINLOG] (
[PartMainLog_ID]
)
GO
ALTER TABLE [dbo].[PARTINSTRUCT] ADD
CONSTRAINT [FK_PARTINSTRUCT_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_PARTINSTRUCT_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
)
GO
ALTER TABLE [dbo].[PARTMAINLOG] ADD
CONSTRAINT [FK_PARTMAINLOG_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
)
GO
ALTER TABLE [dbo].[REJECT] ADD
CONSTRAINT [FK_REJECT_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
),
CONSTRAINT [FK_REJECT_PART] FOREIGN KEY
(
[Part_ID]
) REFERENCES [dbo].[PART] (
[Part_ID]
),
CONSTRAINT [FK_REJECT_ROOTCAUSE] FOREIGN KEY
(
[RootCause_ID]
) REFERENCES [dbo].[ROOTCAUSE] (
[RootCause_ID]
)
GO
ALTER TABLE [dbo].[ROOTCAUSE] ADD
CONSTRAINT [FK_ROOTCAUSE_DEPT] FOREIGN KEY
(
[Dept_ID]
) REFERENCES [dbo].[DEPT] (
[Dept_ID]
)
GO|||DMI wrote:
> Good morning - I have a text file with the information on how to create a
> database, the relationship between tables, etc. I am new to SQL 2005. Wh
at
> I would like to do is to create the database and structure by using this
> following file (MYFILE.SQL) as described below.
> How can I do this?
>
Launch Management Studio, then do File -> Open -> File, navigate to your
MYFILE.SQL, load it, then click Execute

How to create a cystal report based on a text-based data file?

I am a beginner to use cystal report. I wonder if i could establish a report based on a text data file?

for example:

test report 9/20/2004

X Y
--
1 1
2 2
3 3
. .
. .
. .
. .

i'd like to create a graph in my test report. (X axis and Y axis array is based on the above data)

How can i do that? Thanks!

KevinYou can create your report using CDO (Crysal Data Objects). CDO is Crystal's version of a recordset. Basically, you populate a variant array with your data (that you pulled from the text file), then stuff the array into the CDO rowset and pass the CDO Rowset to Crystal.

To get a better explanation and some code examples, do a search for CDO on this forum. I've posted many times with code examples.

As for the Graph, you can click Insert, Chart and follow the instructions from there.

(All of my suggestions and code examples are for vb 6 and CR 8.5 using RDC.)|||As my study, one cystal report has to be set in one path location, right? Because i want to generate a test report for each user specified test record data, the test data is in different location.

So is that possible i can tell cystal report where to find the test data and then generate a report?

Thanks any way!

Kevin|||Using CDO (in the way that I described) gives VB all the control of gathering the data. The only thing Crystal Reports does is display the data that VB passes it. In my opinion, it gives you (as the developer) more control. It's better for error trapping (since you can step through the code and see exactly what is being passed to Crystal).

Try this link:
http://www.dev-archive.com/forum/showthread.php?s=&threadid=281658&highlight=cdo|||thanks a lot!

One more help, i wonder if i could also gerenate the pdf file based on my test data. Do you have any idea on which some control i can use for pdf?

Thanks!

Kevin|||Crystal Reports has it's own built-in Export function. You can export to pdf and several other formats. I can give you code that will work with CR 8.5 using RDC and VB 6 if tha will help you. Otherwise, do a search either on this forum or on the following links:

Crystal Reports Support:
http://support.businessobjects.com/search/advsearch.asp

Crystal Reports Forum:
http://support.businessobjects.com/forums/default.asp|||if you could provide me the sample, that will be great!

Thanks a lot! :)

Kevin|||This example uses CR 8.5 and RDC to export a report to pdf.

Report.ExportOptions.DestinationType = crEDTDiskFile
Report.ExportOptions.FormatType = crEFTPortableDocFormat
Report.ExportOptions.PDFExportAllPages = True

Report.ExportOptions.DiskFileName = strFilePath

'Export to PDF Format, setting False prevents the Export dialog window from showing
Report.Export False|||but how can i let chart draw a curve base on the arrays data, one array is for X-axis, the other is for Y-axis?

Thanks!

Kevin|||I don't how to do charts in Crystal (haven't had to use them yet), but you should be able to click Insert, Chart and follow the directions. Using Groups and Crosstabs has been fairly simple so far, maybe charts will be too?