Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Friday, March 30, 2012

Pros and cons with table lock

I use an ole db destination which I simply use to insert data into database.
If it's configured to use Fast Load as access mode, then it is possible to switch on/off the Lock table property, which is set to true as default.

Are there any drawbacks with switching off the Lock table property? What do I gain when using it?

Thanks for your help!

Its a performance issue. Having a table lock means that the load process doesn't have to worry about lower level locks, and so the load should be quicker.
But it does mean no one else can use that table

Proprties not imported with Table

I am developing a DB with others in my group. When I import tables created on other servers to my server, the primary key and other properties do not import with the tables. Can anyone explain why this is happening? Is there a setting I have over looked?If you use DTS, make usre you use the Copy object(s) instead of Copy table(s) option.|||Nope...what method are you using to migrate the Data

Look at DTS transfer Database Task option

Or better yet, script the objects then build them...I prefer this method, and use bcp|||Originally posted by joejcheng
If you use DTS, make usre you use the Copy object(s) instead of Copy table(s) option.
The copy object worked ... Thanks

Wednesday, March 28, 2012

Property AnsiNullsStatus is not available for UserDefinedFunction...

If you create a table UDF in a SQL 8 database from Server Management
Studio, and then attempt to edit it again, you get the following error:
Property AnsiNullsStatus is not available for UserDefinedFunction
'[dbo].[TF_TEST]'. This property may not exist for this object, or may
not be retrievable due to insufficient access rights.
I have reproduced this with a number of UDFs
The UDF appears to be OK, but it is kind of irritating to have to open
up a different tool to edit it again.
Hello,
I have tested the issue on my side, but I didn't reproduce the issue. To
help me troubleshoot the issue, please post here the detail steps to
reproduce the issue. For your reference, I tested the issue by performing
the following steps:
1. Create a function on a SQL server 2000 database using SQL server 2005
management studio.
create function myuf()
returns table
return (select * from authors)
select * from test5.dbo.myuf()
2. Alter the function:
alter function myuf()
returns table
return (select * from authors where au_id='172-32-1176')
The following command works fine:
select * from test5.dbo.myuf()
I look forward to hearing from you.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
================================================== ===
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Try these steps:
1.Create a multi-statement table function (not an inline; that works
OK) on a SQL 2000 db using SQL server 2005 management studio. I used
the wizard, but doing it by hand produces the same results:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:ScpoRich
-- Create date: 11/25/2005
-- Description:Test Table Function
-- =============================================
CREATE FUNCTION MSDNTest
(
-- Add the parameters for the function here
@.p1 int,
@.p2 char
)
RETURNS
@.Table_Var TABLE
(
c1 int,
c2 int
)
AS
BEGIN
insert into @.Table_Var(c1,c2)
values(@.p1,100)
RETURN
END
GO
2.The following command works fine:
SELECT * FROM [pubs].[dbo].[MSDNTest] (1,'')
3.The following command works fine:
ALTER FUNCTION MSDNTest
(@.p1 int, @.p2 char)
)
RETURNS
@.Table_Var TABLE (c1 int, c2 int)
AS
BEGIN
insert into @.Table_Var(c1,c2)
values(100,@.p1)
RETURN
END
GO
4.Right click function in the Object explorer and select 'Modify' from
the context menu.
5.Observe a dialog box with the following message:
TITLE: Microsoft SQL Server Management Studio
Property QuotedIdentifierStatus is not available for UserDefinedFunction
'[dbo].[MSDNTest]'. This property may not exist for this object, or may
not be retrievable due to insufficient access rights.
(Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?ProdN...s&LinkId=20476
BUTTONS:
OK
6.Selecting Script AS -> CREATE To or Script As -> ALTER to will cause
similar errors to occur.
Sophie Guo [MSFT] wrote:
> Hello,
> I have tested the issue on my side, but I didn't reproduce the issue. To
> help me troubleshoot the issue, please post here the detail steps to
> reproduce the issue. For your reference, I tested the issue by performing
> the following steps:
> 1. Create a function on a SQL server 2000 database using SQL server 2005
> management studio.
> create function myuf()
> returns table
> return (select * from authors)
> select * from test5.dbo.myuf()
> 2. Alter the function:
> alter function myuf()
> returns table
> return (select * from authors where au_id='172-32-1176')
> The following command works fine:
> select * from test5.dbo.myuf()
> I look forward to hearing from you.
> Sophie Guo
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> ================================================== ===
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
|||Hi,
I have been having a similar problem whereby I am trying to script a
bunch of table functions from a SQL Server 2000 database through SQL
Management Studio. I have fiddled around with DB Options but to no
avail. Is there any resolution on this?
Cheers
Dave Mc
david.mcmahon@.ridgian.co.uk
http://www.xmlexperience.com
|||Rich (scporich@.community.nospam) writes:
> If you create a table UDF in a SQL 8 database from Server Management
> Studio, and then attempt to edit it again, you get the following error:
> Property AnsiNullsStatus is not available for UserDefinedFunction
> '[dbo].[TF_TEST]'. This property may not exist for this object, or may
> not be retrievable due to insufficient access rights.
> I have reproduced this with a number of UDFs
> The UDF appears to be OK, but it is kind of irritating to have to open
> up a different tool to edit it again.
There is a very similar bug on
http://lab.msdn.microsoft.com/produc...5-62d1fb31d0a4
which is reported as fixed for SP1.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
|||Hello,
Based on my test, when connectting to a SQL2000 database using the SQL
Managemenet Studio, I can reproduce the issue. However, if I create a SQL
server 2000 database in SQL Managemenet Studio, which means the
compatibility level is "SQL server 2000(80)", everything works fine.
Therefore I think the workaround is to import the SQL server 2000 database
into SQL server 2005 instance. You can import the database using the Copy
database wizard.
I hope the information is helpful.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
================================================== ===
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Erland Sommarskog wrote:
> Rich (scporich@.community.nospam) writes:
>
> There is a very similar bug on
> http://lab.msdn.microsoft.com/produc...5-62d1fb31d0a4
> which is reported as fixed for SP1.
>
Yep - That looks like the one - thanks for the post.
Rich

Property AnsiNullsStatus is not available for UserDefinedFunction

I created a table valued function in SQL Server 2000 SP3 using SQL 2005 Management Studio, but when I try to edit it (Right-Click, Modify or Script Function As...) I get the following error:

Property AnsiNullsStatus is not available for UserDefinedFunction '[dbo].[fnMyTDF]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)

I can edit it in other tools (Sql Query Analyzer) just fine. I'm in the sysadmin role.

Versions:

Microsoft SQL Server Management Studio 9.00.2047.00
Microsoft Analysis Services Client Tools 2005.090.2047.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 6.0.2900.2180
Microsoft .NET Framework 2.0.50727.42
Operating System 5.1.2600

Any thoughts?

Thanks in advance
Dennis

This defect has been fixed in Service Pack 2.

Thanks,
Steve

|||Thanks for the quick response. For future reference, is there a way I could have found this out myself. I thought I searched all the usual places.

thanks
-dennis
|||Do you mean SP2 for Sql 2005? That hasn't been relased, has it?|||

I've installed SP2 for SQL Server 2005 but I get the same error.

I'm using Express Edition and the SP2 Install reports

"The edition of product instance MSSQLSERVER does not qualify for this update" for MSSQLSERVER\Database Services.

Has anybody any other suggestions?

Martin Wills

Property AnsiNullsStatus is not available for UserDefinedFunction

I created a table valued function in SQL Server 2000 SP3 using SQL 2005 Management Studio, but when I try to edit it (Right-Click, Modify or Script Function As...) I get the following error:

Property AnsiNullsStatus is not available for UserDefinedFunction '[dbo].[fnMyTDF]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)

I can edit it in other tools (Sql Query Analyzer) just fine. I'm in the sysadmin role.

Versions:

Microsoft SQL Server Management Studio 9.00.2047.00
Microsoft Analysis Services Client Tools 2005.090.2047.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 6.0.2900.2180
Microsoft .NET Framework 2.0.50727.42
Operating System 5.1.2600

Any thoughts?

Thanks in advance
Dennis

This defect has been fixed in Service Pack 2.

Thanks,
Steve

|||Thanks for the quick response. For future reference, is there a way I could have found this out myself. I thought I searched all the usual places.

thanks
-dennis|||Do you mean SP2 for Sql 2005? That hasn't been relased, has it?|||

I've installed SP2 for SQL Server 2005 but I get the same error.

I'm using Express Edition and the SP2 Install reports

"The edition of product instance MSSQLSERVER does not qualify for this update" for MSSQLSERVER\Database Services.

Has anybody any other suggestions?

Martin Wills

sql

Property AnsiNullsStatus is not available for UserDefinedFunction

I created a table valued function in SQL Server 2000 SP3 using SQL 2005 Management Studio, but when I try to edit it (Right-Click, Modify or Script Function As...) I get the following error:

Property AnsiNullsStatus is not available for UserDefinedFunction '[dbo].[fnMyTDF]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)

I can edit it in other tools (Sql Query Analyzer) just fine. I'm in the sysadmin role.

Versions:

Microsoft SQL Server Management Studio 9.00.2047.00
Microsoft Analysis Services Client Tools 2005.090.2047.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 6.0.2900.2180
Microsoft .NET Framework 2.0.50727.42
Operating System 5.1.2600

Any thoughts?

Thanks in advance
Dennis

This defect has been fixed in Service Pack 2.

Thanks,
Steve

|||Thanks for the quick response. For future reference, is there a way I could have found this out myself. I thought I searched all the usual places.

thanks
-dennis|||Do you mean SP2 for Sql 2005? That hasn't been relased, has it?|||

I've installed SP2 for SQL Server 2005 but I get the same error.

I'm using Express Edition and the SP2 Install reports

"The edition of product instance MSSQLSERVER does not qualify for this update" for MSSQLSERVER\Database Services.

Has anybody any other suggestions?

Martin Wills

Monday, March 26, 2012

Properly copying data of datatype Image

I have a column called "Image" in a table that stores all the user information. Image holds the data for the user's badge photo. I'm currently working on a project to move some of the data from the users table to more relevant tables. With the SQL script I wrote to copy the data into the new tables the image data appears to not have been transferred correctly. I had tried storing the image data into a variable of type varbinary(8000) before inserting it back in. Is there a certain datatype that must be used to store the data when reading from a column of data type "image" and then inserting it into another column of data type "image" without getting truncation or corruption of the data?

Can you please try the following?

HOWTO: Read and Write BLOBs Using GetChunk and AppendChunk
http://support.microsoft.com/default.aspx?scid=kb;en-us;194975
HOWTO: Access and Modify SQL Server BLOB Data by Using the ADO Stream Object
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q258038
How To Read and Write BLOB Data by Using ADO.NET with Visual Basic .NET
http://support.microsoft.com/kb/308042/EN-US

Proper table structure and SQL Server limits

Hello all,
I am migrating a Paradox application to SQL Server. My problem is that the
existing Paradox table structure is limited. Correcting it will mean a
re-write of the application (Delphi app). Although the record and column
limits are higher in SQL Server, it will eventually hit the wall. So I was
wondering if anyone could offer advise on how we might do this best...
The application is essentially an evaluation tool. It is very generic and
can evaluate anything from buying a digital camera or laptop, to purchasing
a house. All the attributes of whatever it is being measure (the
attributes) are defined as a new column.
Example: let's say you are evaluating laptops. The core table may look like
this:
Fields:
1) Identifier
2) Processor Speed
3) Processor Cache
4) Hard Disk Size
5) LAN connection
6) Cost
So in this table, there are 5 things being measure, 6 columns in total. A
record might look like this:
Field Data:
Identifier | Speed | Cache | HD Size | LAN | Cost ...
HP | 3ghz | 2mb | 60G | Wireless | $2000
So you can see that this structure will hit the wall eventually as more and
more criteria are added. With Paradox, the max number of columns is 255. In
SQL Server this is 1024. Of course there is also a maximum record size. For
SQL Server this is 8060 bytes.
What I'd prefer is a structure that has no limits on how big it can be. In
short, I need a new table structure that is long and skinny, vs very wide
(or fat):
Fields:
Identifier
Attribute
Value
So using the above example, the data might look like:
Field Data
Identifier | Attribute | Value
HP | Speed | 3ghz
HP | Cache | 2mb
HP | HD Size | 60G
HP | LAN | Wireless
HP | Cost | $2000
Obviously this structure is preferred because now I won't hit any column or
record limits, but it makes just about everything else in the application
more difficult. Fundamentally data validation becomes difficult
In the above example, how would one define this structure?
Identifier varchar(50)
Attribute varchar(50)
Value ' <-- here lies my problem!!!
In some cases "value" would be an integer, sometimes numeric, sometimes
text. So then I figured, well I could have a number of tables as above,
each for the various data types, integers, numbers, free form text, etc.
Example:
For Integer data
Identifier varchar(50)
Attribute varchar(50)
Value integer
For floating point data
Identifier varchar(50)
Attribute varchar(50)
Value numeric
For free-form data
Identifier varchar(50)
Attribute varchar(50)
Value varchar or ntext
So now I have taken what was in one table, and split it across 3 or more
tables. Of course, all this data would need to be "re-connected" in a grid
like fashion so it looks like just one row of data to the client again.
It all seems to be getting very messy - to simply overcome a column/row
size limitation. Surely there must be an eloquent way to do something like
this?
thanx very much for any input.
regards,
-randall sell"Randall Sell" <randall@.bytewise.nospam.com.au> wrote in message
news:lsjYc.12329$D7.11613@.news-server.bigpond.net.au...
> Hello all,
> I am migrating a Paradox application to SQL Server. My problem is that the
> existing Paradox table structure is limited. Correcting it will mean a
> re-write of the application (Delphi app). Although the record and column
> limits are higher in SQL Server, it will eventually hit the wall. So I was
> wondering if anyone could offer advise on how we might do this best...
>
. . .

> So now I have taken what was in one table, and split it across 3 or more
> tables. Of course, all this data would need to be "re-connected" in a grid
> like fashion so it looks like just one row of data to the client again.
> It all seems to be getting very messy - to simply overcome a column/row
> size limitation. Surely there must be an eloquent way to do something like
> this?
>
You have pretty much worked through he issues here. And you're right: the
free-form attribute storage is a pain to manage, has no data integrity and
performs terribly. I'll just add that it's also not what relational
databases are _for_. An RDBMS is designed to model data using relations. A
relation is a tuple of related values, like
( HP, 3ghz, 2mb, 60G, Wireless, $2000 )
So the original design is the correct one. Mainly for performance reasons,
SqlServer puts a limit on the size of rows (in bytes and in number of
columns). If you really run out of room, you can always just create a
second table, and a third, etc which have a one-to-one relationship with
your original table.
David|||Now why didn't I think of that? That is the sort of input I was looking
for. It would also have some problems, such as creating dynamic queries and
not knowing which table contains a field, but the meta data should sort
that out, so it should be manageable.
thanx
-randall
David Browne wrote:
> So the original design is the correct one. Mainly for performance reasons
,
> SqlServer puts a limit on the size of rows (in bytes and in number of
> columns). If you really run out of room, you can always just create a
> second table, and a third, etc which have a one-to-one relationship with
> your original table.
> David
>

Proper table structure and SQL Server limits

Hello all,
I am migrating a Paradox application to SQL Server. My problem is that the
existing Paradox table structure is limited. Correcting it will mean a
re-write of the application (Delphi app). Although the record and column
limits are higher in SQL Server, it will eventually hit the wall. So I was
wondering if anyone could offer advise on how we might do this best...
The application is essentially an evaluation tool. It is very generic and
can evaluate anything from buying a digital camera or laptop, to purchasing
a house. All the attributes of whatever it is being measure (the
attributes) are defined as a new column.
Example: let's say you are evaluating laptops. The core table may look like
this:
Fields:
1) Identifier
2) Processor Speed
3) Processor Cache
4) Hard Disk Size
5) LAN connection
6) Cost
So in this table, there are 5 things being measure, 6 columns in total. A
record might look like this:
Field Data:
Identifier | Speed | Cache | HD Size | LAN | Cost ...
HP | 3ghz | 2mb | 60G | Wireless | $2000
So you can see that this structure will hit the wall eventually as more and
more criteria are added. With Paradox, the max number of columns is 255. In
SQL Server this is 1024. Of course there is also a maximum record size. For
SQL Server this is 8060 bytes.
What I'd prefer is a structure that has no limits on how big it can be. In
short, I need a new table structure that is long and skinny, vs very wide
(or fat):
Fields:
Identifier
Attribute
Value
So using the above example, the data might look like:
Field Data
Identifier | Attribute | Value
HP | Speed | 3ghz
HP | Cache | 2mb
HP | HD Size | 60G
HP | LAN | Wireless
HP | Cost | $2000
Obviously this structure is preferred because now I won't hit any column or
record limits, but it makes just about everything else in the application
more difficult. Fundamentally data validation becomes difficult
In the above example, how would one define this structure?
Identifier varchar(50)
Attribute varchar(50)
Value ' <-- here lies my problem!!!
In some cases "value" would be an integer, sometimes numeric, sometimes
text. So then I figured, well I could have a number of tables as above,
each for the various data types, integers, numbers, free form text, etc.
Example:
For Integer data
Identifier varchar(50)
Attribute varchar(50)
Value integer
For floating point data
Identifier varchar(50)
Attribute varchar(50)
Value numeric
For free-form data
Identifier varchar(50)
Attribute varchar(50)
Value varchar or ntext
So now I have taken what was in one table, and split it across 3 or more
tables. Of course, all this data would need to be "re-connected" in a grid
like fashion so it looks like just one row of data to the client again.
It all seems to be getting very messy - to simply overcome a column/row
size limitation. Surely there must be an eloquent way to do something like
this?
thanx very much for any input.
regards,
-randall sell"Randall Sell" <randall@.bytewise.nospam.com.au> wrote in message
news:lsjYc.12329$D7.11613@.news-server.bigpond.net.au...
> Hello all,
> I am migrating a Paradox application to SQL Server. My problem is that the
> existing Paradox table structure is limited. Correcting it will mean a
> re-write of the application (Delphi app). Although the record and column
> limits are higher in SQL Server, it will eventually hit the wall. So I was
> wondering if anyone could offer advise on how we might do this best...
>
. . .
> So now I have taken what was in one table, and split it across 3 or more
> tables. Of course, all this data would need to be "re-connected" in a grid
> like fashion so it looks like just one row of data to the client again.
> It all seems to be getting very messy - to simply overcome a column/row
> size limitation. Surely there must be an eloquent way to do something like
> this?
>
You have pretty much worked through he issues here. And you're right: the
free-form attribute storage is a pain to manage, has no data integrity and
performs terribly. I'll just add that it's also not what relational
databases are _for_. An RDBMS is designed to model data using relations. A
relation is a tuple of related values, like
( HP, 3ghz, 2mb, 60G, Wireless, $2000 )
So the original design is the correct one. Mainly for performance reasons,
SqlServer puts a limit on the size of rows (in bytes and in number of
columns). If you really run out of room, you can always just create a
second table, and a third, etc which have a one-to-one relationship with
your original table.
David|||Now why didn't I think of that? That is the sort of input I was looking
for. It would also have some problems, such as creating dynamic queries and
not knowing which table contains a field, but the meta data should sort
that out, so it should be manageable.
thanx
-randall
David Browne wrote:
> So the original design is the correct one. Mainly for performance reasons,
> SqlServer puts a limit on the size of rows (in bytes and in number of
> columns). If you really run out of room, you can always just create a
> second table, and a third, etc which have a one-to-one relationship with
> your original table.
> David
>sql

Proper table structure and SQL Server limits

Hello all,
I am migrating a Paradox application to SQL Server. My problem is that the
existing Paradox table structure is limited. Correcting it will mean a
re-write of the application (Delphi app). Although the record and column
limits are higher in SQL Server, it will eventually hit the wall. So I was
wondering if anyone could offer advise on how we might do this best...
The application is essentially an evaluation tool. It is very generic and
can evaluate anything from buying a digital camera or laptop, to purchasing
a house. All the attributes of whatever it is being measure (the
attributes) are defined as a new column.
Example: let's say you are evaluating laptops. The core table may look like
this:
Fields:
1) Identifier
2) Processor Speed
3) Processor Cache
4) Hard Disk Size
5) LAN connection
6) Cost
So in this table, there are 5 things being measure, 6 columns in total. A
record might look like this:
Field Data:
Identifier | Speed | Cache | HD Size | LAN | Cost ...
HP | 3ghz | 2mb | 60G | Wireless | $2000
So you can see that this structure will hit the wall eventually as more and
more criteria are added. With Paradox, the max number of columns is 255. In
SQL Server this is 1024. Of course there is also a maximum record size. For
SQL Server this is 8060 bytes.
What I'd prefer is a structure that has no limits on how big it can be. In
short, I need a new table structure that is long and skinny, vs very wide
(or fat):
Fields:
Identifier
Attribute
Value
So using the above example, the data might look like:
Field Data
Identifier | Attribute | Value
HP | Speed | 3ghz
HP | Cache | 2mb
HP | HD Size | 60G
HP | LAN | Wireless
HP | Cost | $2000
Obviously this structure is preferred because now I won't hit any column or
record limits, but it makes just about everything else in the application
more difficult. Fundamentally data validation becomes difficult
In the above example, how would one define this structure?
Identifier varchar(50)
Attribute varchar(50)
Value ? <-- here lies my problem!!!
In some cases "value" would be an integer, sometimes numeric, sometimes
text. So then I figured, well I could have a number of tables as above,
each for the various data types, integers, numbers, free form text, etc.
Example:
For Integer data
Identifier varchar(50)
Attribute varchar(50)
Value integer
For floating point data
Identifier varchar(50)
Attribute varchar(50)
Value numeric
For free-form data
Identifier varchar(50)
Attribute varchar(50)
Value varchar or ntext
So now I have taken what was in one table, and split it across 3 or more
tables. Of course, all this data would need to be "re-connected" in a grid
like fashion so it looks like just one row of data to the client again.
It all seems to be getting very messy - to simply overcome a column/row
size limitation. Surely there must be an eloquent way to do something like
this?
thanx very much for any input.
regards,
-randall sell
"Randall Sell" <randall@.bytewise.nospam.com.au> wrote in message
news:lsjYc.12329$D7.11613@.news-server.bigpond.net.au...
> Hello all,
> I am migrating a Paradox application to SQL Server. My problem is that the
> existing Paradox table structure is limited. Correcting it will mean a
> re-write of the application (Delphi app). Although the record and column
> limits are higher in SQL Server, it will eventually hit the wall. So I was
> wondering if anyone could offer advise on how we might do this best...
>
.. . .

> So now I have taken what was in one table, and split it across 3 or more
> tables. Of course, all this data would need to be "re-connected" in a grid
> like fashion so it looks like just one row of data to the client again.
> It all seems to be getting very messy - to simply overcome a column/row
> size limitation. Surely there must be an eloquent way to do something like
> this?
>
You have pretty much worked through he issues here. And you're right: the
free-form attribute storage is a pain to manage, has no data integrity and
performs terribly. I'll just add that it's also not what relational
databases are _for_. An RDBMS is designed to model data using relations. A
relation is a tuple of related values, like
( HP, 3ghz, 2mb, 60G, Wireless, $2000 )
So the original design is the correct one. Mainly for performance reasons,
SqlServer puts a limit on the size of rows (in bytes and in number of
columns). If you really run out of room, you can always just create a
second table, and a third, etc which have a one-to-one relationship with
your original table.
David
|||Now why didn't I think of that? That is the sort of input I was looking
for. It would also have some problems, such as creating dynamic queries and
not knowing which table contains a field, but the meta data should sort
that out, so it should be manageable.
thanx
-randall
David Browne wrote:
> So the original design is the correct one. Mainly for performance reasons,
> SqlServer puts a limit on the size of rows (in bytes and in number of
> columns). If you really run out of room, you can always just create a
> second table, and a third, etc which have a one-to-one relationship with
> your original table.
> David
>

Proper Sorting of Months In DropdownList

I'm having an issue getting the data how I want it from SQL to then populate my dropdownlist.

I have a table called SALES_BUDGR_TBL that contains alot of columns but the ones I'm focusing on are SRCURM (Month) and SRACYR (Year). What I need to do is populate a dropdownlist and show the current month first and then work backwards. The data in the dabase goes back 14 months. I created a reference table called MonthOrder that has 3 columns, MonthID, MonthName and MonthAbrv. I did this so I have a way of saying which month belongs where when sorted.

Here is the select statement I currently have. I'm joining the tables and then I want to Order by the MonthID, but I would also like it to show the 2006 records first, then goto 2005, starting with December and going down of course.

Is there anyway to do this? My Select and Results are below...

SELECT DISTINCT SB.SRCURM, SB.SRACYR, MO.MonthID, MO.MonthName FROM SALES_BUDGR_TBL SB
INNER JOIN MonthOrder MO ON SB.SRCURM = MO.MonthAbrv
ORDER BY MO.MonthID DESC

DEC 2005 12 December
NOV 2005 11 November
OCT 2005 10 October
SEP 2005 09 September
AUG 2005 08 August
JUL 2005 07 July
JUN 2005 06 June
MAY 2005 05 May
APR 2005 04 April
APR 2006 04 April
MAR 2006 03 March
FEB 2005 02 Febuary
FEB 2006 02 Febuary
JAN 2006 01 January

If I say only get 2006 records it works but I need a better way to do this.

Please try to modify your ORDER clause to:

ORDER BY SB.SRACYR DESC, MO.MonthID DESC

|||

SELECT DISTINCT SB.SRACYR AS Year,DATEPART(month,SB.SRCURM+' 01, 2006') AS Month,CAST(SB.SRCURM+' 01, '+SB.SRACYR) AS MyDate FROM SALES_BUDGR_TBL SB
ORDER BY SB.SRACYR DESC,DATEPART(month,SB.SRCURM+' 01, 2006') DESC

|||Thanks, I got it working.

Friday, March 23, 2012

Propagation of event notification when tables are updated.

I would like to propagate an event signal to an external application
when a table in my MSSql2000 server is updated.

Prog A; I have an external application adding records to a table.
Prog B; I have another external application using this table as well.

When Prog A creates a new record in the Table, how can I have Prog B be
notified of the event without polling the table or creating a link
between Prog A and Prog B.

Thanks.> When Prog A creates a new record in the Table, how can I have Prog B be
> notified of the event

Depends what you mean by "notified". If you want to invoke some code within
the current process (B) then the obvious way is to have B read a table or
watch for some other event and then act accordingly. What exactly do you
want to achieve? Is this simply about optimistic locking?

--
David Portas
SQL Server MVP
--|||dubian (collatz@.bigtexansoftware.com) writes:
> I would like to propagate an event signal to an external application
> when a table in my MSSql2000 server is updated.
> Prog A; I have an external application adding records to a table.
> Prog B; I have another external application using this table as well.
> When Prog A creates a new record in the Table, how can I have Prog B be
> notified of the event without polling the table or creating a link
> between Prog A and Prog B.

By far, the easiest way is to poll.

The other way would be to have a trigger on the table, that fires of an
extended stored procedure or OLE object to somehow send a singal to
Process B. Since extended stored procedures and local OLE objects in
the same memory space as the rest of SQL Server, they are somewhat
dangerous: if they crash on an access violation, the entire server
goes belly-up.

I believe that you also can use the sp_OAxxx routiens to start an
OLE object on a remote server. In this there is less risk for crashes.
But this is like to take time, and when you are in a trigger you are
in a transaction hold locks. If the update frequency is high, this
trigger can kill your throughput.

A variation is to have the trigger to write to a table, and then
run a job from SQL Server Agent that reads the table and alerts the
other process. Such a job would run once a minute or so. Since this job
could be an ActiveX task you could signal with XP:s and that.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Propagating results of Alter Table to its views

When I alter a table to add columns or change their properties, either in
Enterprise Manager or with T-SQL statements in Query Analyzer, the
alterations are not automatically noticed by the views that use the table.
The only thing I have been able to figure out to do is to find each
potentially affected view and then:
1. Open it in design mode
2. Check or uncheck a field in the Altered table
3. Uncheck or check the same field to restore the view to its original field
selection
4. Close the view and Save it.
Two problems:
1. That's tedious and time-consuming
2. It is easy to miss an affected view.
Can someone advise me as to a better way? (I am mostly using SQL Server 2000
)
Thanks,
Doug MacLeanDoug MacLean wrote:
> When I alter a table to add columns or change their properties, either in
> Enterprise Manager or with T-SQL statements in Query Analyzer, the
> alterations are not automatically noticed by the views that use the table.
> The only thing I have been able to figure out to do is to find each
> potentially affected view and then:
> 1. Open it in design mode
> 2. Check or uncheck a field in the Altered table
> 3. Uncheck or check the same field to restore the view to its original fie
ld
> selection
> 4. Close the view and Save it.
> Two problems:
> 1. That's tedious and time-consuming
> 2. It is easy to miss an affected view.
> Can someone advise me as to a better way? (I am mostly using SQL Server 20
00)
> --
> Thanks,
> Doug MacLean
Firstly, do not use SELECT * in views. It's generally a bad idea to use
SELECT * anywhere in production code. It's a particularly bad idea in
views because of the way views handle changes to the columns.
So assuming you have named columns in all your views, use
sp_refreshview to ensure the view is up to date with changes to its
columns. If you want to add a column you'll have to edit the view
definition of course, which is good practice and not difficult if you
have adequate source control and change control procedures. Table
changes should never be executed by Enterprise Manager in a production
environment.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||David,
Thanks. That's very helpful. It eliminates the need for my 4-step process in
Enterprise Manager.
I wonder if there is a tool to list all of the views that depend on a
specified table, because the other challenge is actually finding all of them
when altering a table.
Best Regards,
--
Doug MacLean
"David Portas" wrote:

> Doug MacLean wrote:
> Firstly, do not use SELECT * in views. It's generally a bad idea to use
> SELECT * anywhere in production code. It's a particularly bad idea in
> views because of the way views handle changes to the columns.
> So assuming you have named columns in all your views, use
> sp_refreshview to ensure the view is up to date with changes to its
> columns. If you want to add a column you'll have to edit the view
> definition of course, which is good practice and not difficult if you
> have adequate source control and change control procedures. Table
> changes should never be executed by Enterprise Manager in a production
> environment.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||Greetings,
"Doug MacLean" <DougMacLean@.discussions.microsoft.com> wrote in message
news:C701B020-919E-44B3-A61E-1FCF7AC6AA8D@.microsoft.com...
> David,
> Thanks. That's very helpful. It eliminates the need for my 4-step process
> in
> Enterprise Manager.
> I wonder if there is a tool to list all of the views that depend on a
> specified table, because the other challenge is actually finding all of
> them
> when altering a table.
> Best Regards,
> --
> Doug MacLean
Create the views WITH SCHEMABINDING and you won't be able to change the
table without first dropping the view. This is a good reminder to fix the
view ;-)
Regards,
Neale NOON|||You may want to use this.
select * from INFORMATION_SCHEMA.VIEW_TABLE_USAGE
where table_name = '<table_name>'
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||> I wonder if there is a tool to list all of the views that depend on a
> specified table, because the other challenge is actually finding all of
> them
> when altering a table.
You might find it easier to refresh all views since you cannot rely on
dependency information unless the views were created WITH SCHEMABINDING.
The script below will generate a script to refresh all views in the current
database. You can wrap it in a cursor and execute according to your
preference. BTW, even without 'SELECT *', you can run into issues with
changed datatypes in the referenced tables.
SELECT
'EXEC sp_refreshview ''' +
QUOTENAME(TABLE_SCHEMA) +
N'.' +
QUOTENAME(TABLE_NAME) +
''''
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'VIEW'
AND OBJECTPROPERTY(OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) +
N'.' +
QUOTENAME(TABLE_NAME)
), 'IsMSShipped') = 0
Hope this helps.
Dan Guzman
SQL Server MVP
"Doug MacLean" <DougMacLean@.discussions.microsoft.com> wrote in message
news:C701B020-919E-44B3-A61E-1FCF7AC6AA8D@.microsoft.com...
> David,
> Thanks. That's very helpful. It eliminates the need for my 4-step process
> in
> Enterprise Manager.
> I wonder if there is a tool to list all of the views that depend on a
> specified table, because the other challenge is actually finding all of
> them
> when altering a table.
> Best Regards,
> --
> Doug MacLean
>
> "David Portas" wrote:
>|||Thanks, Neale.
That's an interesting idea to know when I change a table that has one or
more dependent views. So it is a good reminder.
But I KNOW there are views. And what I want is a clean way of finding and
refreshing them. Adding a process of dropping (and then re-adding) them seem
s
tedious.
Thanks Best Regards,
--
Doug MacLean
"Neale NOON" wrote:

> Greetings,
> "Doug MacLean" <DougMacLean@.discussions.microsoft.com> wrote in message
> news:C701B020-919E-44B3-A61E-1FCF7AC6AA8D@.microsoft.com...
>
> Create the views WITH SCHEMABINDING and you won't be able to change the
> table without first dropping the view. This is a good reminder to fix the
> view ;-)
> --
> Regards,
> Neale NOON
>
>|||Dan,
Ahhh!. That's a great idea. Thanks for both the idea and the sample code.
And it's practical because I only do such updates on the production system a
t
times when no one is using it.
You're right. I've already seen the problem that -- even without adding
columns -- the view needs to be refreshed.
Thanks much and Best regards,
--
Doug MacLean
"Dan Guzman" wrote:

> You might find it easier to refresh all views since you cannot rely on
> dependency information unless the views were created WITH SCHEMABINDING.
> The script below will generate a script to refresh all views in the curren
t
> database. You can wrap it in a cursor and execute according to your
> preference. BTW, even without 'SELECT *', you can run into issues with
> changed datatypes in the referenced tables.
> SELECT
> 'EXEC sp_refreshview ''' +
> QUOTENAME(TABLE_SCHEMA) +
> N'.' +
> QUOTENAME(TABLE_NAME) +
> ''''
> FROM INFORMATION_SCHEMA.TABLES
> WHERE TABLE_TYPE = 'VIEW'
> AND OBJECTPROPERTY(OBJECT_ID(
> QUOTENAME(TABLE_SCHEMA) +
> N'.' +
> QUOTENAME(TABLE_NAME)
> ), 'IsMSShipped') = 0
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Doug MacLean" <DougMacLean@.discussions.microsoft.com> wrote in message
> news:C701B020-919E-44B3-A61E-1FCF7AC6AA8D@.microsoft.com...
>
>

Propagate NEW Table to Anon Merge Replicas

How do I get a New Table to propagate to Anonymous Merge Subscribers, WITH
Add, Update, Delete Triggers?
I created a new Table (by running a SQL Script created on a Developer
machine) on a Remote SBS 2003 Server (SQL 2K). It Propagated to Subscribers,
OK. But it is useless, because is missing the Triggers: dbo.ins_ ... ,
dbo.upd_ ... , dbo.del_ ...
What did I miss, and Where? when I created the Prototype?
Aubrey Kelley
It sounds like merge replication has not placed all of the object it
requires on the subscriber. Are all objects owned by dbo? There were some
problems on pre SP 4 service packs with this.
How did you create the new table and add it to the merge publication? How
did you deploy it to your subscribers?
The best way to fix this is to reinitialize, generate a new snapshot and
send it to the subscribers. Any other approach may fix this particular
problem but there could be further missing objects and the merge replication
metadata may be in an inconsistent state.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Aubrey" <miscuates@.online.nospam> wrote in message
news:B1E8B402-7B5B-4DD3-8389-9BBC7D99F109@.microsoft.com...
> How do I get a New Table to propagate to Anonymous Merge Subscribers, WITH
> Add, Update, Delete Triggers?
> I created a new Table (by running a SQL Script created on a Developer
> machine) on a Remote SBS 2003 Server (SQL 2K). It Propagated to
> Subscribers,
> OK. But it is useless, because is missing the Triggers: dbo.ins_ ... ,
> dbo.upd_ ... , dbo.del_ ...
> What did I miss, and Where? when I created the Prototype?
> --
> Aubrey Kelley

Prooblem inserting into a table

Hi! I am currently trying to insert some values into a table. I have a very strange problem. I get the error message that i am trying to insert a null value into one of my colums, the problem is that when I write the value to a label control before I runs the insert method on my SqlDataSource control the value is not NULL. If i push the insert button on my webpage once again everything is ok.

What am I doing wrong? Anyone seen this kind of problem before?

regards,

Lumsen

Hi,

You can use the SQL Profiler to see which sql statement runs on the database after you click the button. If the error message is an sql error then you can see the statement by using the profiler.

Eralper

|||Can't be sure without more details. It could depends on what data control you're using, if any, and posting your code may help people to get better idea.|||without more info, its hard to tell. One thing you can do is add a watch to that variable and see if it is NULL at the wrong time.|||

Thanks for trying to help me out!

Here is the code from my asp page:

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="newassesment.aspx.vb" Inherits="newassesment" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Add a new assesment<br />
<br />
<asp:Label ID="Label1" runat="server" Text="assesment id"></asp:Label>
<asp:TextBox ID="text_assesment_id" runat="server"></asp:TextBox><br />
<br />
<asp:Label ID="Label2" runat="server" Text="primary language"></asp:Label>
<asp:DropDownList ID="prim_lang_DropDownList" runat="server" DataSourceID="SqlDataSource2"
DataTextField="language_id" DataValueField="language_id">
</asp:DropDownList>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="# of answer alternatives"></asp:Label>
<asp:TextBox ID="text_ans_alt" runat="server"></asp:TextBox><br />
<br />
<asp:Label ID="Label4" runat="server" Text="Dont know allowed"></asp:Label>
<asp:CheckBox ID="checkBox_dont_know_allowed" runat="server" /><br />
<br />
<asp:Label ID="Label5" runat="server" Text="Light level"></asp:Label>
<asp:CheckBox ID="checkBox_light_level" runat="server" /><br />
<br />
<asp:Label ID="Label6" runat="server" Text="Medium level"></asp:Label>
<asp:CheckBox ID="checkBox_medium_level" runat="server" /><br />
<br />
<asp:Label ID="Label7" runat="server" Text="Extensive level"></asp:Label>
<asp:CheckBox ID="checkBox_extensive_level" runat="server" /><br />
<br />
<asp:Button ID="button_submit" runat="server" Text="Submit" />
<asp:Label ID="label_error" runat="server" ForeColor="Red"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AssesmentConnectionString2 %>"
DeleteCommand="DELETE FROM [assesment_definition] WHERE [assesment_id] = @.assesment_id"
InsertCommand="INSERT INTO [assesment_definition] ([assesment_id], [primary_language_id], [number_of_answer_alternatives], [dont_know_answer_accepted], [light_level], [medium_level], [extensive_level]) VALUES (@.assesment_id, @.primary_language_id, @.number_of_answer_alternatives, @.dont_know_answer_accepted, @.light_level, @.medium_level, @.extensive_level)"
SelectCommand="SELECT * FROM [assesment_definition]" UpdateCommand="UPDATE [assesment_definition] SET [primary_language_id] = @.primary_language_id, [number_of_answer_alternatives] = @.number_of_answer_alternatives, [dont_know_answer_accepted] = @.dont_know_answer_accepted, [light_level] = @.light_level, [medium_level] = @.medium_level, [extensive_level] = @.extensive_level WHERE [assesment_id] = @.assesment_id">
<DeleteParameters>
<asp:Parameter Name="assesment_id" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="primary_language_id" Type="String" />
<asp:Parameter Name="number_of_answer_alternatives" Type="Int32" />
<asp:Parameter Name="dont_know_answer_accepted" Type="Boolean" />
<asp:Parameter Name="light_level" Type="Boolean" />
<asp:Parameter Name="medium_level" Type="Boolean" />
<asp:Parameter Name="extensive_level" Type="Boolean" />
<asp:Parameter Name="assesment_id" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:FormParameter FormField="text_assesment_id" Name="assesment_id" Type="String" />
<asp:FormParameter FormField="prim_lang_DropDownList" Name="primary_language_id"
Type="String" />
<asp:FormParameter FormField="text_ans_alt" Name="number_of_answer_alternatives"
Type="Int32" />
<asp:FormParameter FormField="text_dontknowallowed" Name="dont_know_answer_accepted"
Type="Boolean" DefaultValue="" />
<asp:FormParameter FormField="text_lightlevel" Name="light_level" Type="Boolean" DefaultValue="false" />
<asp:FormParameter FormField="text_mediumlevel" Name="medium_level" Type="Boolean" DefaultValue="false" />
<asp:FormParameter FormField="text_extensivelevel" Name="extensive_level" Type="Boolean" DefaultValue="false" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:AssesmentConnectionString2 %>"
SelectCommand="SELECT [language_id] FROM [language]"></asp:SqlDataSource>
<br />
<br />
<br />
<asp:TextBox ID="text_dontknowallowed" runat="server" CausesValidation="True"></asp:TextBox><br />
<asp:TextBox ID="text_lightlevel" runat="server"></asp:TextBox><br />
<asp:TextBox ID="text_mediumlevel" runat="server"></asp:TextBox><br />
<asp:TextBox ID="text_extensivelevel" runat="server"></asp:TextBox><br />
<br />
<br />
<asp:Label ID="testLabel" runat="server" ForeColor="Blue"></asp:Label></div>
</form>
</body>
</html>

And the code when the submit button is clicked:


Partial Class newassesment
Inherits System.Web.UI.Page

Protected Sub button_submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button_submit.Click

text_dontknowallowed.Text = checkBox_dont_know_allowed.Checked
text_lightlevel.Text = checkBox_light_level.Checked
text_mediumlevel.Text = checkBox_medium_level.Checked
text_extensivelevel.Text = checkBox_extensive_level.Checked

testLabel.Text = SqlDataSource1.InsertCommand()

Try

Dim recAff As String

recAff = SqlDataSource1.Insert()

label_error.Text = (recAff & " record inserted successfully!")


Catch SQLExp As System.Data.SqlClient.SqlException

label_error.Text = "An SQL Server Error Occurred: " & SQLExp.Message()

Catch except As Exception

label_error.Text = except.ToString()


End Try


End Sub



Protected Sub checkBox_dont_know_allowed_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkBox_dont_know_allowed.CheckedChanged

testLabel.Text = "HALLO"

End Sub
End Class

Do this help?

Thanks

Lumsen

|||

Why aren't you using one of the data controls (DetailsView or FormView) along with your SqlDataSource? They were meant to be used together. I suppose you could somehow make your code work properly, but it may prove difficult to get everything right. Also, FormView/DetailsView allow paging, edit, delete, insert to take place automatically and does data binding for you. By not using these controls, you're choosing to manually handle everything (sort of reinventing the wheel). Finally, I'm not sure if anyone will be willing to help you implement something so out of the ordinary.

So, my advice is for you to go with FormView control for Insert, Edit, Delete of your data. It'll make your project far easier.

|||You shouldn't be using formparameters to pull from ASP.NET controls to start. Either make them Parameters, and set them manually, or make them controlparameters to pull from an ASP.NET control, or change all your textboxes from ASP.NET controls to form controls "<INPUT TYPE=...>" and use formparameters.|||Thanks for guiding me! Works a lot better with the formview control!

Just one problem remains.. I want to make one of the fields in the formview a dropdownlist, where the items are selected from another table than the table associated with the formview. Is that possible?

Thanks!

Lumsen|||Using a DropDownList control within a FormView is possible. That topic has been covered many times before, so rather than describing the whole process again, try searching the forum for the keywords "formview dropdownlist".

Wednesday, March 21, 2012

Prompt for a database name

Hi,
Is there a way to prompt someone to enter a database name in a script? For
example, I have a script where I need to update a table to set a column with
a value found in another table in another database. We don't know exactly
what the actual db name is of where to find the table and we would like, in
the script, to be able to allow the user enter the db name so that we can do
the update correctly. We don't want to have the user to manually update
script to specify the db name in the update statement, but rather prompt them
for the name so that we can do the update for them.
Thanks in advance,
DeeSQL Server cannot prompt, it is a service running on a server machine. The client app can. What
app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
> Hi,
> Is there a way to prompt someone to enter a database name in a script? For
> example, I have a script where I need to update a table to set a column with
> a value found in another table in another database. We don't know exactly
> what the actual db name is of where to find the table and we would like, in
> the script, to be able to allow the user enter the db name so that we can do
> the update correctly. We don't want to have the user to manually update
> script to specify the db name in the update statement, but rather prompt them
> for the name so that we can do the update for them.
> Thanks in advance,
> Dee|||Hi Tibor,
We're using Query Analyzer. When we upgrade a customer's database for db
changes, we actually create a script where we have them run it manually via
Query Analyzer.
Thanks!
Dee
"Tibor Karaszi" wrote:
> SQL Server cannot prompt, it is a service running on a server machine. The client app can. What
> app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "bpdee" <bpdee@.discussions.microsoft.com> wrote in message
> news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
> > Hi,
> >
> > Is there a way to prompt someone to enter a database name in a script? For
> > example, I have a script where I need to update a table to set a column with
> > a value found in another table in another database. We don't know exactly
> > what the actual db name is of where to find the table and we would like, in
> > the script, to be able to allow the user enter the db name so that we can do
> > the update correctly. We don't want to have the user to manually update
> > script to specify the db name in the update statement, but rather prompt them
> > for the name so that we can do the update for them.
> >
> > Thanks in advance,
> > Dee
>|||I see. QA has no prompting abilities. In fact, none of the tools that comes with SQL Server has
such. SQLCMD (comes with 2005, you can also download it), has a command-line option for specifying
values for variables (defined inside the script file). Check out -v and $(varname). If you need true
prompting, you have to write some app that pops up the prompt and runs what you have in the script
file.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:E6CD55B3-3550-4B9E-B45B-3BE7A81132BD@.microsoft.com...
> Hi Tibor,
> We're using Query Analyzer. When we upgrade a customer's database for db
> changes, we actually create a script where we have them run it manually via
> Query Analyzer.
> Thanks!
> Dee
> "Tibor Karaszi" wrote:
>> SQL Server cannot prompt, it is a service running on a server machine. The client app can. What
>> app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "bpdee" <bpdee@.discussions.microsoft.com> wrote in message
>> news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
>> > Hi,
>> >
>> > Is there a way to prompt someone to enter a database name in a script? For
>> > example, I have a script where I need to update a table to set a column with
>> > a value found in another table in another database. We don't know exactly
>> > what the actual db name is of where to find the table and we would like, in
>> > the script, to be able to allow the user enter the db name so that we can do
>> > the update correctly. We don't want to have the user to manually update
>> > script to specify the db name in the update statement, but rather prompt them
>> > for the name so that we can do the update for them.
>> >
>> > Thanks in advance,
>> > Dee
>>

Prompt for a database name

Hi,
Is there a way to prompt someone to enter a database name in a script? For
example, I have a script where I need to update a table to set a column with
a value found in another table in another database. We don't know exactly
what the actual db name is of where to find the table and we would like, in
the script, to be able to allow the user enter the db name so that we can do
the update correctly. We don't want to have the user to manually update
script to specify the db name in the update statement, but rather prompt the
m
for the name so that we can do the update for them.
Thanks in advance,
DeeSQL Server cannot prompt, it is a service running on a server machine. The c
lient app can. What
app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
> Hi,
> Is there a way to prompt someone to enter a database name in a script? Fo
r
> example, I have a script where I need to update a table to set a column wi
th
> a value found in another table in another database. We don't know exactly
> what the actual db name is of where to find the table and we would like, i
n
> the script, to be able to allow the user enter the db name so that we can
do
> the update correctly. We don't want to have the user to manually update
> script to specify the db name in the update statement, but rather prompt t
hem
> for the name so that we can do the update for them.
> Thanks in advance,
> Dee|||Hi Tibor,
We're using Query Analyzer. When we upgrade a customer's database for db
changes, we actually create a script where we have them run it manually via
Query Analyzer.
Thanks!
Dee
"Tibor Karaszi" wrote:

> SQL Server cannot prompt, it is a service running on a server machine. The
client app can. What
> app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "bpdee" <bpdee@.discussions.microsoft.com> wrote in message
> news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
>|||I see. QA has no prompting abilities. In fact, none of the tools that comes
with SQL Server has
such. SQLCMD (comes with 2005, you can also download it), has a command-line
option for specifying
values for variables (defined inside the script file). Check out -v and $(va
rname). If you need true
prompting, you have to write some app that pops up the prompt and runs what
you have in the script
file.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:E6CD55B3-3550-4B9E-B45B-3BE7A81132BD@.microsoft.com...[vbcol=seagreen]
> Hi Tibor,
> We're using Query Analyzer. When we upgrade a customer's database for db
> changes, we actually create a script where we have them run it manually vi
a
> Query Analyzer.
> Thanks!
> Dee
> "Tibor Karaszi" wrote:
>|||555

Prompt for a database name

Hi,
Is there a way to prompt someone to enter a database name in a script? For
example, I have a script where I need to update a table to set a column with
a value found in another table in another database. We don't know exactly
what the actual db name is of where to find the table and we would like, in
the script, to be able to allow the user enter the db name so that we can do
the update correctly. We don't want to have the user to manually update
script to specify the db name in the update statement, but rather prompt them
for the name so that we can do the update for them.
Thanks in advance,
Dee
Hi Tibor,
We're using Query Analyzer. When we upgrade a customer's database for db
changes, we actually create a script where we have them run it manually via
Query Analyzer.
Thanks!
Dee
"Tibor Karaszi" wrote:

> SQL Server cannot prompt, it is a service running on a server machine. The client app can. What
> app/tool are you using? SQLCMD, OSQL, SSMS, QA, something else?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "bpdee" <bpdee@.discussions.microsoft.com> wrote in message
> news:130AABB7-8F8B-4F47-8A27-119F022F49F3@.microsoft.com...
>

Tuesday, March 20, 2012

Progress Indicator for Table Reindex

I am reindex a 100 Gig Table with 30 million rows. It is currently running 14
hours.
Is there any way for me to find out approx when this will end (ie percent
complete)
No. There is no progress reporting for index ops in SQL Server 2000 or 2005.
Do you know how long the index took to reindex last time? That would be the
basis for a rough first-order approximation of the run-time this time. Other
factors that make determining this very difficult are concurrent cpu and I/O
load and distribution of free space in the database (basically you need to
have another 120 Gb of free space to be able to rebuild a 100 Gb clustered
index - if you don't the files will grow during the operation).
Regards
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mark Gozick" <MarkGozick@.discussions.microsoft.com> wrote in message
news:666E1A4F-D8AF-440C-8D56-84A5DF1DE0EC@.microsoft.com...
> I am reindex a 100 Gig Table with 30 million rows. It is currently running
14
> hours.
> Is there any way for me to find out approx when this will end (ie percent
> complete)
>
|||100GB "TABLE" ?
how big is the DB ?
Greg Jackson
PDX, Oregon
|||the DB is 400 Gig. The 100 Gig table is the General Ledger Detail table which
is quite large. We can only keep 2 years on-line.
"pdxJaxon" wrote:

> 100GB "TABLE" ?
> how big is the DB ?
>
> Greg Jackson
> PDX, Oregon
>
>
|||Mark Gozick wrote:
> the DB is 400 Gig. The 100 Gig table is the General Ledger Detail
> table which is quite large. We can only keep 2 years on-line.
Did you just say "only"? ...
robert
|||That's not that big any more...
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Robert Klemme" <bob.news@.gmx.net> wrote in message
news:u4COG9HYFHA.3356@.TK2MSFTNGP15.phx.gbl...
> Mark Gozick wrote:
> Did you just say "only"? ...
> robert
>

Progress Indicator for Table Reindex

I am reindex a 100 Gig Table with 30 million rows. It is currently running 14
hours.
Is there any way for me to find out approx when this will end (ie percent
complete)No. There is no progress reporting for index ops in SQL Server 2000 or 2005.
Do you know how long the index took to reindex last time? That would be the
basis for a rough first-order approximation of the run-time this time. Other
factors that make determining this very difficult are concurrent cpu and I/O
load and distribution of free space in the database (basically you need to
have another 120 Gb of free space to be able to rebuild a 100 Gb clustered
index - if you don't the files will grow during the operation).
Regards
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mark Gozick" <MarkGozick@.discussions.microsoft.com> wrote in message
news:666E1A4F-D8AF-440C-8D56-84A5DF1DE0EC@.microsoft.com...
> I am reindex a 100 Gig Table with 30 million rows. It is currently running
14
> hours.
> Is there any way for me to find out approx when this will end (ie percent
> complete)
>|||100GB "TABLE" ?
how big is the DB ?
Greg Jackson
PDX, Oregon|||the DB is 400 Gig. The 100 Gig table is the General Ledger Detail table which
is quite large. We can only keep 2 years on-line.
"pdxJaxon" wrote:
> 100GB "TABLE" ?
> how big is the DB ?
>
> Greg Jackson
> PDX, Oregon
>
>|||Mark Gozick wrote:
> the DB is 400 Gig. The 100 Gig table is the General Ledger Detail
> table which is quite large. We can only keep 2 years on-line.
Did you just say "only"? ...
robert|||That's not that big any more...
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Robert Klemme" <bob.news@.gmx.net> wrote in message
news:u4COG9HYFHA.3356@.TK2MSFTNGP15.phx.gbl...
> Mark Gozick wrote:
> > the DB is 400 Gig. The 100 Gig table is the General Ledger Detail
> > table which is quite large. We can only keep 2 years on-line.
> Did you just say "only"? ...
> robert
>