Showing posts with label tables. Show all posts
Showing posts with label tables. Show all posts

Friday, March 30, 2012

Mirroring for certain tables from the database in sql 2005

Can I know is it possible using database mirroring for only certain tables from the database, not for the whole database in sql server 2005. Hopefully able to get any assistance here. Thx alot.

Best Regards,

Hans

Mirroring is at the database level (not the instance level, not the table level)

|||oic. thanks for the information. :)|||

Hi Jerry, sorry for bothering you again. Can I ask some questions regarding the connection for the database mirroring. Actually I did post a thread here and hope can get any assistance from you. If can, I prefer to share/discuss the problem for solving this scenario which is the Error 1418 through messenger. Hope to hear from you soon. Thanx a lot and have a nice day, Jerry.

Best Regards,

Hans

Mirroring for certain tables from the database in sql 2005

Can I know is it possible using database mirroring for only certain tables from the database, not for the whole database in sql server 2005. Hopefully able to get any assistance here. Thx alot.

Best Regards,

Hans

Mirroring is at the database level (not the instance level, not the table level)

|||oic. thanks for the information. :)|||

Hi Jerry, sorry for bothering you again. Can I ask some questions regarding the connection for the database mirroring. Actually I did post a thread here and hope can get any assistance from you. If can, I prefer to share/discuss the problem for solving this scenario which is the Error 1418 through messenger. Hope to hear from you soon. Thanx a lot and have a nice day, Jerry.

Best Regards,

Hans

sql

Wednesday, March 28, 2012

Mirror Status

Are there Stored Procedures or tables that will tell me which of the mirrore
d
servers is active ?Is this a database mirroring question? Mirroring is at the database level.
Try
select * from sys.database_mirroring
and look for mirroring_role and mirroring_role_desc. They should say
PRINCIPAL or MIRROR.
Hope this helps,
Ben Nevarez, MCDBA, OCP
Database Administrator
"PJU" wrote:

> Are there Stored Procedures or tables that will tell me which of the mirro
red
> servers is active ?
>

Mirror Status

Are there Stored Procedures or tables that will tell me which of the mirrored
servers is active ?Is this a database mirroring question? Mirroring is at the database level.
Try
select * from sys.database_mirroring
and look for mirroring_role and mirroring_role_desc. They should say
PRINCIPAL or MIRROR.
Hope this helps,
Ben Nevarez, MCDBA, OCP
Database Administrator
"PJU" wrote:
> Are there Stored Procedures or tables that will tell me which of the mirrored
> servers is active ?
>

Monday, March 26, 2012

MINUS operation between table date ranges, is my algorithm sound?

Hi everyone, i was hoping someone could help me.
i am looking to implement a MINUS operation between two tables which contain
date ranges.
table a:
[start] [finish] [group]
1 10 0
18 19 1
23 26 2
28 31 3
table b:
[start] [finish]
4 5
18 18
25 28
Result of table a - table b:
[start] [finish]
1 3
6 10
19 19
23 24
29 31
Would anyone know how to implement this? I have done this by firstly
performing an AND operation between the two tables:
table a AND table b = table c (here the grouping colums tells me which group
from table a the date range is associated with
[start] [finish] [group]
4 5 0
18 18 1
25 26 2
28 28 3
Then I throw table a and c into another table (d). Here I assign:
start date of table a: status = 1
end date of table a: status = 0
start date of table b: status = 0
end date of table b: status = 1
start of date range in table a: boundary = 0
end of date range for table a: boundary = 2
boundary = 1 for all data coming from table b
table d:
[date] [status] [group] [boundary]
1 1 0 1
10 0 0 3
18 1 1 1
19 0 1 3
23 1 2 1
26 0 2 3
28 1 3 1
31 0 3 3
4 0 0 2
5 1 0 2
18 0 1 2
18 1 1 2
25 0 2 2
26 1 2 2
28 0 3 2
28 1 3 2
I then sort using the SQL statement: order by 3,1,2 to get:
table d:
[date] [status] [group] [boundary]
1 1 0 1
4 0 0 2
5 1 0 2
10 0 0 3
18 1 1 1
18 0 1 2
18 1 1 2
19 0 1 3
23 1 2 1
25 0 2 2
26 1 2 2
26 0 2 3
28 1 3 1
28 0 3 2
28 1 3 2
31 0 3 3
I then update the table according to:
case
when boundary = 2 and status = 0 then data = date -1
when boundary = 2 and status = 1 then data = date +1
end
and I get:
table d:
[date] [status] [group] [boundary]
1 1 0 1
3 0 0 2
6 1 0 2
10 0 0 3
18 1 1 1
17 0 1 2
19 1 1 2
19 0 1 3
23 1 2 1
24 0 2 2
27 1 2 2
26 0 2 3
28 1 3 1
27 0 3 2
29 1 3 2
31 0 3 3
I then filter the table and look for adjacient row pairs where row(i)=1 and
row(i+1)=0 :
table d:
[date] [status] [group] [boundary]
1 1 0 1
3 0 0 2
6 1 0 2
10 0 0 3
18 1 1 1
17 0 1 2
19 1 1 2
19 0 1 3
23 1 2 1
24 0 2 2
27 1 2 2
26 0 2 3
28 1 3 1
27 0 3 2
29 1 3 2
31 0 3 3
I delete those pairs where (date(i) < date(i+1) and boundary(i) >
boundary(i+1) to get:
table d:
[date] [status] [group] [boundary]
1 1 0 1
3 0 0 2
6 1 0 2
10 0 0 3
19 1 1 2
19 0 1 3
23 1 2 1
24 0 2 2
29 1 3 2
31 0 3 3
This then gives me the resultant table im looking for:
table d recast:
[start] [finish]
1 3
6 10
19 19
23 24
29 31
Is my approach sound? I am yet to encode the above in SQL. Maybe there is a
faster approach to getting this result?
Any help most appreciated!
cheers, peter"peter walker" <pwalker@.nospam.com> wrote in message
news:ucoD$XLGGHA.3056@.TK2MSFTNGP09.phx.gbl...
> Hi everyone, i was hoping someone could help me.
> i am looking to implement a MINUS operation between two tables which
> contain date ranges.
> table a:
> [start] [finish] [group]
> 1 10 0
> 18 19 1
> 23 26 2
> 28 31 3
>
> table b:
> [start] [finish]
> 4 5
> 18 18
> 25 28
> Result of table a - table b:
> [start] [finish]
> 1 3
> 6 10
> 19 19
> 23 24
> 29 31
> Would anyone know how to implement this? I have done this by firstly
Read my signature to see how much information you left out.
Let's assume your tables look like this:
CREATE TABLE a (start INTEGER NOT NULL PRIMARY KEY /* ' Was not specified
*/, finish INTEGER NOT NULL, CHECK (start<=finish) /* ? Was not specified
*/, grp INTEGER NOT NULL /* "GROUP" is a reserved word - not a good column
name */);
CREATE TABLE b (start INTEGER NOT NULL PRIMARY KEY /* ' */, finish INTEGER
NOT NULL, CHECK (start<=finish));
Your sample data:
INSERT INTO a (start,finish,grp)
SELECT 1, 10, 0 UNION ALL
SELECT 18, 19, 1 UNION ALL
SELECT 23, 26, 2 UNION ALL
SELECT 28, 31, 3;
INSERT INTO b (start, finish)
SELECT 4, 5 UNION ALL
SELECT 18, 18 UNION ALL
SELECT 25, 28;
I'll also assume you have a table of numbers - all integers from 0 to some
arbitrarily large number. One way to get the missing numbers would be like
this:
SELECT n.num
FROM numbers AS n
LEFT JOIN b
ON n.num BETWEEN b.start AND b.finish
WHERE b.start IS NULL
AND n.num BETWEEN
(SELECT MIN(start)
FROM a) AND
(SELECT MAX(finish)
FROM a);
I don't quite understand the significance of the "group" column here. Please
give us a better spec if you need more help.
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
--|||Hi, thanks for the post. Im the original poster of this topic (at work
using a friend's account).
Please disregard the [group] column in my initial description of the
problem. I used a [group] column within my algorithm. In effect I would
like to know the best way to implement a subtraction of date ranges as
follows:
table a:
[start] [finish]
1 10
18 19
23 26
28 31
table b:
[start] [finish]
4 5
18 18
25 28
Result of table a - table b:
[start] [finish]
1 3
6 10
19 19
23 24
29 31
in effect, if a date range in table_b intersects a date range in
table_a, then that data in the intersection is removed from the date
range in table_a
for example, the following are example cases where we subtract from a
range in table_a where there are ranges in table_b which intersect with
that range in table_a:
1. {23....37} - {25...29} = {23...24}
2. {23....37} - {26...32} = {23...25}, {33...37}
3. {23....37} - [ {25...27} , {31...33} ] = {23...24}, {28...30},
{34...37}
Any help on this would be great!
Many thanks.
peter|||Peter,
this is very ugly :)
but the SELECT statement should work
i use a table of natural numbers proposed by David
David, pardon me for the use of your idea :)
SELECT MIN(U.seq) as start, MAX(U.seq) as finish
FROM (SELECT G.seq, G.seq - COUNT(*)
FROM (SELECT GS.seq
FROM TableA AS GA, Sequence AS GS
WHERE GS.seq BETWEEN GA.start AND GA.finish
AND NOT EXISTS(SELECT *
FROM TableB AS GB, Sequence AS GSS
WHERE GSS.seq BETWEEN GB.start AND
GB.finish
AND GSS.seq = GS.seq)) AS G,
(SELECT LS.seq
FROM TableA AS LA, Sequence AS LS
WHERE LS.seq BETWEEN LA.start AND LA.finish
AND NOT EXISTS(SELECT *
FROM TableB AS LB, Sequence AS LSS
WHERE LSS.seq BETWEEN LB.start AND
LB.finish
AND LSS.seq = LS.seq)) AS L
WHERE L.seq <= G.seq
GROUP BY G.seq) AS U(seq, gb)
GROUP BY U.gb;
Andrey Odegov
avodeGOV@.yandex.ru
(remove GOV to respond)|||On Sat, 14 Jan 2006 12:55:36 +1000, peter walker wrote:

>Hi everyone, i was hoping someone could help me.
(snip)
Hi Peter,
I just posted a reply to your first thread about this issue.
Hugo Kornelis, SQL Server MVP|||Hello There,
I hope this might solve your problem.
Create Table TableA
(
[start] int,
[finish] int,
[group] int
)
Go
Insert into TableA
Select 1 ,10 ,0
Union All
Select 18, 19 ,1
Union All
Select 23, 26 ,2
Union All
Select 28 ,31 ,3
Go
Create Table TableB
(
[start] int,
[finish] int
)
Go
Insert into TableB
Select 4 ,5
Union All
Select 18 ,18
Union All
Select 25 ,28
Go
Create View vwTmpData
As
Select * From (
Select 1 N
Union All
Select 2
Union All
Select 3
Union All
Select 4
Union All
Select 5
Union All
Select 6
Union All
Select 7
Union All
Select 8
Union All
Select 9
Union All
Select 10
Union All
Select 11
Union All
Select 12
Union All
Select 13
Union All
Select 14
Union All
Select 15
Union All
Select 16
Union All
Select 17
Union All
Select 18
Union All
Select 19
Union All
Select 20
Union All
Select 21
Union All
Select 22
Union All
Select 23
Union All
Select 24
Union All
Select 25
Union All
Select 26
Union All
Select 27
Union All
Select 28
Union All
Select 29
Union All
Select 30
Union All
Select 31
Union All
Select 32
Union All
Select 33
) Seq Inner Join TableA T1 On N Between T1.start and T1.finish
Where N Not In (Select Start From tableB Union Select Finish From
TableB)
Go
Select identity(int,1,1) N1,* into tmpData From vwTmpData
Update tmpData Set [group] = [group] + 1
Where N - N1> 0
Select Min(N) Start,Max(N) Finish From tmpData Group by [group]
Drop Table tmpData
Drop View vwTmpData
Drop Table TableA
Drop Table TableB
With Warm regards
Jatinder Singh

Friday, March 23, 2012

Mining cubes vs relational

I've not found much guidance so far about the pros and cons of mining OLAP cubes vs their underlying fact and dimension tables. Can anyone offer advice in this area, or point me to more info about this?

Thanks,
Kevin

Generally I recommend mining OLAP cubes when you are mining results that OLAP is good at producing, otherwise you should mine relational tables. OLAP is not particularly good at returning large amounts of detail data. However, if you were mining stores, for example, and your inputs were total sales of products for particular months/categories, or even sales acceleration of such by store, those measures are very difficult and slow to obtain through relational means, and I would recommend OLAP.

Another issue with OLAP MM's is that there really isn't any way to split data into training and validation sets. If this is a requirement, and you need to use the aggregation/calculation facilities of OLAP, you can get the OLAP results into a table, split into training and validation sets, and then mine the resultant relational table.

sql

Mining Accuracy Chart, predictable column in nested tables

In the Mining Accuracy Chart, the predictable columns of nested tables does not show up in the "Select predictable mining model columns to show in the lift chart" table. The "Predictable column name" is empty.

Predictable columns in the case table shows up, but not the predictable columns in the nested table. What am I missing?

-Young K

The accuracy chart currently does not support predictable columns in nested tables.

Wednesday, March 21, 2012

Minimum components required to create 2005 database/tables programmatically

I want to know what are the minimum SQL Server 2005 tools required to perform the following task, and how do I install them:

1. I have a server with SQLS 2005 (and all of its management components) installed. Let's call this Server A. I want to create a database and tables in an instance on this machine.

2. I have another machine (Workstation B) on the same domain from which I want to programmatically create the database on Server A with legacy code that uses SQL-DMO.

What are the minimum components (i.e. SQLDMO for 2005?) I need to install on Workstation B and how/where are they available/packaged? I know that SMO is the replacement for SQLDMO, but we're not ready to upgrade to it yet and we still want to create databases on the 2005 instance.

Thanks in advance,

jd

You just have to install SQLDMO for SQL 2005. It is available as a separate download as part of SQL Server 2005 Feature Pack.

You can get it from here:

http://www.microsoft.com/downloads/details.aspx?familyid=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en

Regards,

Minimum components required to create 2005 database/tables programmatically

I want to know what are the minimum SQL Server 2005 tools required to perform the following task, and how do I install them:

1. I have a server with SQLS 2005 (and all of its management components) installed. Let's call this Server A. I want to create a database and tables in an instance on this machine.

2. I have another machine (Workstation B) on the same domain from which I want to programmatically create the database on Server A with legacy code that uses SQL-DMO.

What are the minimum components (i.e. SQLDMO for 2005?) I need to install on Workstation B and how/where are they available/packaged? I know that SMO is the replacement for SQLDMO, but we're not ready to upgrade to it yet and we still want to create databases on the 2005 instance.

Thanks in advance,

jd

You just have to install SQLDMO for SQL 2005. It is available as a separate download as part of SQL Server 2005 Feature Pack.

You can get it from here:

http://www.microsoft.com/downloads/details.aspx?familyid=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en

Regards,

Minimizing Locking Question

Hello all,
I am working on an Access 2000 project that is used to generate reports on archived sales data. This app uses linked tables that are pointing to some SQL 2K tables. Some of the queries are large and end up creating a table lock when executed, blocking all other users from using the app until it has finished executing the query. I would like to have queries that read data ignore this lock on the table but do not know of a way to do this using linked tables in Access 2000. I would use a NOLOCk table hint but need something else for this issue.
Any ideas?
ThanksWhat else do you need other than NOLOCK with linked tables?

Monday, March 19, 2012

Min(), MAX() Question

Hi,
I have two tables : Table1, Table2
CREATE TABLE [dbo].[Table1] (
[Product] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SaleDate] [datetime] NULL ,
[Price] [decimal](18, 2) NULL ,
[Customer] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Table2] (
[Product] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ReportDate] [datetime] NULL ,
[ReportPrice] [decimal](18, 2) NULL ,
[Customer] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
-- And here is some data
INSERT INTO [Table1]
([Product],[SaleDate],[Price],[Customer]
)VALUES('A','Jan 1 2005
12:00:00:000AM',10.50,'001')
INSERT INTO [Table1]
([Product],[SaleDate],[Price],[Customer]
)VALUES('A','Jan 1 2005
12:00:00:000AM',9.50,'001')
INSERT INTO [Table1]
([Product],[SaleDate],[Price],[Customer]
)VALUES('A','Feb 2 2005
12:00:00:000AM',9.00,'001')
INSERT INTO [Table1]
([Product],[SaleDate],[Price],[Customer]
)VALUES('A','Feb 1 2005
12:00:00:000AM',6.00,'001')
INSERT INTO [Table1]
([Product],[SaleDate],[Price],[Customer]
)VALUES('A','Feb 2 2005
12:00:00:000AM',7.00,'001')
INSERT INTO [Table1]
([Product],[SaleDate],[Price],[Customer]
)VALUES('A','Oct 10 2005
12:00:00:000AM',30.00,'001')
INSERT INTO [Table2]
([Product],[ReportDate],[ReportPrice],[C
ustomer])VALUES('A','May 1 2005
12:00:00:000AM',0,'001')
I need a query to update ReportPrice From Table2 with the Maximum Saledate
from table1 less then ReportDate from Table2 and the price=Min for that
date for that specific date.
This is my query
UPDATE t2 SET t2.ReportPrice=t1.Price FROM
(
Select Max(SaleDate) as SaleDate,Min(Price) AS PRICE ,Customer,Product From
Table1
GROUP BY Customer,Product) as t1,Table2 as t2
WHERE t1.SaleDate< t2.ReportDate and t1.Product = t2.Product and
t1.Customer=t2.Customer
Select * FROM Table1
Select * FROM Table2
, but is wrong .. I get 6 instead of 7 . I need 7 to be the ReportPrice.
Thanks guys !Do:
UPDATE table2
SET ReportPrice =
( SELECT MIN( Price ) FROM table1
WHERE table1.Product = table2.Product
AND table1.Customer = table2.Customer
AND table1.SaleDate = ( SELECT MAX( t1.SaleDate ) FROM Table1 t1
WHERE table1.Product = t1.Product
AND table1.Customer = t1.Customer ) )
WHERE EXISTS
( SELECT * FROM table1
WHERE table1.Product = table2.Product
AND table1.Customer = table2.Customer ) ;
With a t-SQL TOP clause in the subquery, it should be a bit more simpler
though:
UPDATE table2
SET ReportPrice = (
SELECT TOP 1 Price FROM table1
WHERE table1.Product = table2.Product
AND table1.Customer = table2.Customer
ORDER BY table1.SaleDate DESC, Price )
WHERE ...
Anith|||Is not working !
The ideea is good but i need ReportPrice to be 7. In this case will be 30 .
I need somewhere a condition MAX( SaleDate ) <ReportDate
Thanks
"Anith Sen" <anith@.bizdatasolutions.com> wrote in message
news:ef4W3Z2pFHA.3104@.TK2MSFTNGP12.phx.gbl...
> Do:
> UPDATE table2
> SET ReportPrice =
> ( SELECT MIN( Price ) FROM table1
> WHERE table1.Product = table2.Product
> AND table1.Customer = table2.Customer
> AND table1.SaleDate = ( SELECT MAX( t1.SaleDate ) FROM Table1
> t1
> WHERE table1.Product = t1.Product
> AND table1.Customer =
> t1.Customer ) )
> WHERE EXISTS
> ( SELECT * FROM table1
> WHERE table1.Product = table2.Product
> AND table1.Customer = table2.Customer ) ;
> With a t-SQL TOP clause in the subquery, it should be a bit more simpler
> though:
> UPDATE table2
> SET ReportPrice = (
> SELECT TOP 1 Price FROM table1
> WHERE table1.Product = table2.Product
> AND table1.Customer = table2.Customer
> ORDER BY table1.SaleDate DESC, Price )
> WHERE ...
> --
> Anith
>|||Thanks!
Is working now !
UPDATE table2
SET ReportPrice =
( SELECT MIN( Price ) FROM table1
WHERE table1.Product = table2.Product
AND table1.Customer = table2.Customer
AND table1.SaleDate = ( SELECT MAX( t1.SaleDate ) FROM Table1 t1
WHERE table1.Product = t1.Product
AND table1.Customer = t1.Customer and
t1.SaleDate<Table2.ReportDate )
)
WHERE EXISTS
( SELECT * FROM table1
WHERE table1.Product = table2.Product
AND table1.Customer = table2.Customer ) ;
Select * FROM Table1
Select * FROM Table2
"Anith Sen" <anith@.bizdatasolutions.com> wrote in message
news:ef4W3Z2pFHA.3104@.TK2MSFTNGP12.phx.gbl...
> Do:
> UPDATE table2
> SET ReportPrice =
> ( SELECT MIN( Price ) FROM table1
> WHERE table1.Product = table2.Product
> AND table1.Customer = table2.Customer
> AND table1.SaleDate = ( SELECT MAX( t1.SaleDate ) FROM Table1
> t1
> WHERE table1.Product = t1.Product
> AND table1.Customer =
> t1.Customer ) )
> WHERE EXISTS
> ( SELECT * FROM table1
> WHERE table1.Product = table2.Product
> AND table1.Customer = table2.Customer ) ;
> With a t-SQL TOP clause in the subquery, it should be a bit more simpler
> though:
> UPDATE table2
> SET ReportPrice = (
> SELECT TOP 1 Price FROM table1
> WHERE table1.Product = table2.Product
> AND table1.Customer = table2.Customer
> ORDER BY table1.SaleDate DESC, Price )
> WHERE ...
> --
> Anith
>

Friday, March 9, 2012

Migration to Yukon

Hi,

Anyone kindly let me know more and clear details about the below 2 statements

1.Remove reference to undocumented system tables/stored procs

2. Remove statements modifying system objects

as are not supported in SQL Server 2005. while migrating from sql server 2000 to YUkon (sql server 2005) the above 2 points need to be taken care. but no much clarity on the above.

kindly help me

Regards

Crish

Hi,

not sure above the first one, which procedure are deprecated but the latter one had some major chnages. The system objects are now in the sys schema,e.g. changing the sysobjects to sys.objects. if you used INFORMATION_SCHEMA views before you don′t need to change anything, because the views were also modified to reflect the changes, if you use direct access to the system tables, you have to change your code.

HTH, Jens SUessmeyer.


http://www.sqlserver2005.de

|||Thanks much for the information Jens.

Wednesday, March 7, 2012

Migration of database from MS SQL to Pervasive SQL and vice versa

Hi,
would to know what are the ways to migrate DB/copy tables
(1) from MS SQL to Pervasive SQL and
(2) from Pervasive SQL to MS SQL
Thank you.
Regards. SallyOriginally posted by sallypeh
Hi,
would to know what are the ways to migrate DB/copy tables
(1) from MS SQL to Pervasive SQL and
(2) from Pervasive SQL to MS SQL

Thank you.
Regards. Sally

From Pervasive to SQL Server works well through the Import / Export Wizard (and DTS), using Pervasive's ODBC or OLE DB.
I have not had any reason to try it the other way, but it should work too.

Cheers,
Robert

Migration from Sybase to SQL 2000 problems

Hello,
I'm having a problem migrating a particular stored Procedure wich runs
nested and interdependent Fetching from temporary tables.
There is a main cursor and from that, a var is retrieved for use as a
parameter for other cursors. The most important is that the Cursor's queryes
all run successfully independently and with the parameters filled in.
//main cursor
declare CritSelAgr cursor for
select CodCritSelec, TodosSectInst, TodosPrzContr, TodosPais,
TodosMoeda, Coeficiente
from P_TRMCCSE0
where MRCUIC = @.PCodRub and
MRCUKN = @.PVersRub
order by CodCritSelec
for read only
select @.ErroSql = @.@.error
if @.ErroSql <> 0
begin
exec PCRMZZZZ0itratamsg @.ErroSql
return @.ErroSql
end
//dependent cursor *uses CodCritSelec from the main cursor
declare CritInstrFin cursor for
select CodInstrFin, CIF.CodTpConta, DescTpConta
from P_TRMCCIF0 CIF,
VRMCTCO00 TCO
where MRCUIC = @.PCodRub and
MRCUKN = @.PVersRub and
CodCritSelec = @.CodCritSelec and
CIF.CodTpConta = TCO.CodTpConta
order by CodInstrFin, TCO.CodTpConta
for read only
select @.ErroSql = @.@.error
if @.ErroSql <> 0
begin
exec PCRMZZZZ0itratamsg @.ErroSql
return @.ErroSql
end
In the stored procedure they do not work, only the main query, wich has all
parameters set works well.
//this is an extract of the code from the stored procedure
open CritSelAgr
select @.ErroSql = @.@.error
if @.ErroSql <> 0
begin
exec PCRMZZZZ0itratamsg @.ErroSql
return @.ErroSql
end
select @.SqlStat = 0
while( @.SqlStat = 0 )
begin
fetch CritSelAgr into @.CodCritSelec, @.TodosSectInst, @.TodosPrzContr,
@.TodosPais,
@.TodosMoeda, @.Coeficiente
select @.ErroSql = @.@.error, @.SqlStat = @.@.fetch_status
if @.ErroSql <> 0
begin
exec PCRMZZZZ0itratamsg @.ErroSql
return @.ErroSql
end
if @.SqlStat <> 0
break
select @.InstrFin = NULL, @.SectInst = NULL, @.PrzContr = NULL, @.Pais =
NULL, @.Moeda = NULL
open CritInstrFin
select @.ErroSql = @.@.error
if @.ErroSql <> 0
begin
exec PCRMZZZZ0itratamsg @.ErroSql
return @.ErroSql
end
select @.SqlStatCrit = 0
while( @.SqlStatCrit = 0 )
begin
fetch CritInstrFin into @.CodInstrFin, @.CodTpConta, @.DescTpConta
select @.ErroSql = @.@.error, @.SqlStatCrit = @.@.fetch_status
//*****@.@.fetch_status is ALWAYS -1 here and in the other cursors as well
Is there a way to pass explicitly the parameters to a cursor or it's enough
to have the vars defined in the scope? (I think that's the problem)
Thaks in advanceSince you are changing platforms, wouldn't now be a good time to get rid of
any legacy cursor code? I expect this could be done much more quickly and
efficiently with set-based code.
If you need more help, please post a fuller description of the problem as
explained in the following article:
http://www.aspfaq.com/etiquette.asp?id=5006
David Portas
SQL Server MVP
--|||Thanks for the reply,
Do you mean
Set @.var = value?
"David Portas" wrote:

> Since you are changing platforms, wouldn't now be a good time to get rid o
f
> any legacy cursor code? I expect this could be done much more quickly and
> efficiently with set-based code.
> If you need more help, please post a fuller description of the problem as
> explained in the following article:
> http://www.aspfaq.com/etiquette.asp?id=5006
> --
> David Portas
> SQL Server MVP
> --
>|||No. Set-based code means declarative SQL code that operates on entire sets o
f
rows. On the other hand, cursor code only processes one row at a time. SQL
Server is optimized for set-based code, not for cursors.
Without more information it's hard to guess how to do it in your case but
you should aim to write code using regular SELECT, UPDATE, INSERT and DELETE
statements *without* cursors. Cursors are rarely a good idea and most of the
time you don't need them.
David Portas
SQL Server MVP
--|||do you mean set based logic like in joins?
as for ex: in http://techrepublic.com.com/5100-6228_11-5532304.html
"David Portas" wrote:

> No. Set-based code means declarative SQL code that operates on entire sets
of
> rows. On the other hand, cursor code only processes one row at a time. SQL
> Server is optimized for set-based code, not for cursors.
> Without more information it's hard to guess how to do it in your case but
> you should aim to write code using regular SELECT, UPDATE, INSERT and DELE
TE
> statements *without* cursors. Cursors are rarely a good idea and most of t
he
> time you don't need them.
> --
> David Portas
> SQL Server MVP
> --|||Joins are set based operations, yes.
David Portas
SQL Server MVP
--

Migration from SQL 2003 to 2005

I have an SQL database that uses standard tables and stored procedures
- no triggers and functions. I have a Microsoft Excel based front-end
which uses ADO to access the DB to (1) run stored procedures (some SPs
return recordsets and some do not), (2) insert data into tables (3)
edit table data using simple linked grid based forms.
This DB was initially created in SQL 2000 and then installed on a SQL
2003 server - absolutely no issues. Now, I have to upgrade to SQL
2005. I am not concerned about DB Admin issues but only my procedures
should not stop working or ADO calls not working (note that I am NOT
using the .NET platform).
It is probably difficult to give any sure answer with this limited
information but I am mainly looking for standard issues that most SQL
2003 databases will face on upgrading to 2005.
Thanks,
Jay
P.S. I am concerned about things like...SQL 2005 has changed the
syntax for cursors; it does not support regular ADO and you must use
ADO.NET; data type Decimal is not available any more and you must use
Numeric; Basically, things like these that will require me to change
my table structures or procedures.
Jay
Download Upgrade Advisor tool from MS site and run it against SS2000
database, see report file.
"Jay" <jay6447@.hotmail.com> wrote in message
news:35224406-0ab6-45a3-a92f-410aed08a23f@.s13g2000prd.googlegroups.com...
> I have an SQL database that uses standard tables and stored procedures
> - no triggers and functions. I have a Microsoft Excel based front-end
> which uses ADO to access the DB to (1) run stored procedures (some SPs
> return recordsets and some do not), (2) insert data into tables (3)
> edit table data using simple linked grid based forms.
> This DB was initially created in SQL 2000 and then installed on a SQL
> 2003 server - absolutely no issues. Now, I have to upgrade to SQL
> 2005. I am not concerned about DB Admin issues but only my procedures
> should not stop working or ADO calls not working (note that I am NOT
> using the .NET platform).
> It is probably difficult to give any sure answer with this limited
> information but I am mainly looking for standard issues that most SQL
> 2003 databases will face on upgrading to 2005.
> Thanks,
> Jay
>
> P.S. I am concerned about things like...SQL 2005 has changed the
> syntax for cursors; it does not support regular ADO and you must use
> ADO.NET; data type Decimal is not available any more and you must use
> Numeric; Basically, things like these that will require me to change
> my table structures or procedures.
>
>

Migration from SQL 2003 to 2005

I have an SQL database that uses standard tables and stored procedures
- no triggers and functions. I have a Microsoft Excel based front-end
which uses ADO to access the DB to (1) run stored procedures (some SPs
return recordsets and some do not), (2) insert data into tables (3)
edit table data using simple linked grid based forms.
This DB was initially created in SQL 2000 and then installed on a SQL
2003 server - absolutely no issues. Now, I have to upgrade to SQL
2005. I am not concerned about DB Admin issues but only my procedures
should not stop working or ADO calls not working (note that I am NOT
using the .NET platform).
It is probably difficult to give any sure answer with this limited
information but I am mainly looking for standard issues that most SQL
2003 databases will face on upgrading to 2005.
Thanks,
Jay
P.S. I am concerned about things like...SQL 2005 has changed the
syntax for cursors; it does not support regular ADO and you must use
ADO.NET; data type Decimal is not available any more and you must use
Numeric; Basically, things like these that will require me to change
my table structures or procedures.Jay
Download Upgrade Advisor tool from MS site and run it against SS2000
database, see report file.
"Jay" <jay6447@.hotmail.com> wrote in message
news:35224406-0ab6-45a3-a92f-410aed08a23f@.s13g2000prd.googlegroups.com...
> I have an SQL database that uses standard tables and stored procedures
> - no triggers and functions. I have a Microsoft Excel based front-end
> which uses ADO to access the DB to (1) run stored procedures (some SPs
> return recordsets and some do not), (2) insert data into tables (3)
> edit table data using simple linked grid based forms.
> This DB was initially created in SQL 2000 and then installed on a SQL
> 2003 server - absolutely no issues. Now, I have to upgrade to SQL
> 2005. I am not concerned about DB Admin issues but only my procedures
> should not stop working or ADO calls not working (note that I am NOT
> using the .NET platform).
> It is probably difficult to give any sure answer with this limited
> information but I am mainly looking for standard issues that most SQL
> 2003 databases will face on upgrading to 2005.
> Thanks,
> Jay
>
> P.S. I am concerned about things like...SQL 2005 has changed the
> syntax for cursors; it does not support regular ADO and you must use
> ADO.NET; data type Decimal is not available any more and you must use
> Numeric; Basically, things like these that will require me to change
> my table structures or procedures.
>
>|||"Jay" <jay6447@.hotmail.com> wrote in message
news:35224406-0ab6-45a3-a92f-410aed08a23f@.s13g2000prd.googlegroups.com...
> I have an SQL database that uses standard tables and stored procedures
> - no triggers and functions. I have a Microsoft Excel based front-end
> which uses ADO to access the DB to (1) run stored procedures (some SPs
> return recordsets and some do not), (2) insert data into tables (3)
> edit table data using simple linked grid based forms.
> This DB was initially created in SQL 2000 and then installed on a SQL
> 2003 server - absolutely no issues. Now, I have to upgrade to SQL
> 2005. I am not concerned about DB Admin issues but only my procedures
> should not stop working or ADO calls not working (note that I am NOT
> using the .NET platform).
> It is probably difficult to give any sure answer with this limited
> information but I am mainly looking for standard issues that most SQL
> 2003 databases will face on upgrading to 2005.
> Thanks,
> Jay
>
> P.S. I am concerned about things like...SQL 2005 has changed the
> syntax for cursors; it does not support regular ADO and you must use
> ADO.NET; data type Decimal is not available any more and you must use
> Numeric; Basically, things like these that will require me to change
> my table structures or procedures.
>
Hi Jay
There was not a version SQL 2003, so I assume this is Windows 2003 and the
SQL Server did not change?
To help you prepare the upgrade to SQL 2005 look at the upgrade advisor to
see what you may need to change when upgrading the database
http://www.microsoft.com/downloads/details.aspx?FamilyID=1470e86b-7e0...
and the upgrade handbook is worth checking out for the additional steps you
will need to do such as rebuilding indexes, statistics and updating usage
http://www.microsoft.com/technet/prodtechnol/sql/2005/sqlupgrd.mspx.
John

Saturday, February 25, 2012

Migration from Access to Sql Server

Hi, I import my tables from Access to SQl Server 2000
actually MSDE with the SQL server tools.

Is there a way to have the same table name as in access
because in SQl server it seems I have to call my
tables that way : testdb.dbo.po instead of just po in VB access.
That means changing all my Querys :(

Also I installed sql server on 1 PC (WinXp Pro) on my network and install the client
tools on another PC (Win98) but how can I access SQL Server from that PC?
When I'm in VB and do a connection with the ADO object I don't get
any server listed in it??
My connection string use on my local PC with server on it is working fine.

StrSqlSrv = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;Initial Catalog=imdedi;" & _
"Data Source=" & servername

Also Is it possible to package (With VB package) a program using MSDE so that it will
install MSDE and create all tables on the client PC?

Can DAO connects to sql server?

Thank you. I know... alot of questions :)> That means changing all my Querys :(

no it doesn't. try it. you can use

databasename.username.tablename

or just

tablename|||Hi, this is my connections that work fine with ADO
The only thing I do is changing the ConnectionString to my Sql Server
To make it work I have to use the .dbo thing....
This works ->> testdb.dbo.company

company.ConnectionString = StrSqlSrv
company.RecordSource = "SELECT compno,compname,telno FROM company ORDER BY compno;"

company.Refresh

Here is the error I get
A message box display Invalif Object Name company
When I click OK then
a run-time error"
(80040e37) Method 'Refresh' of Object 'IAdodc' failed|||Hi, I was able to access my tables without the .dbo
I was missing a user...

Migration ACCESS --> SQL Linked table

Hi again,
I have paradox table linked in an access database. I want to migrate to SQL.
Can I link these tables in SQL ?
ThanksAccess does a better job of linking to ISAMs than SQLS does (which
uses the Jet provider). Is there any way you can migrate ALL of the
data? If linking to other ISAMs is a big part of your app, you might
be better keeping that part of it in Access/Jet. You can always link
to SQL Server tables as well.
-- Mary
Microsoft Access Developer's Guide to SQL Server
http://www.amazon.com/exec/obidos/ASIN/0672319446
On Thu, 6 Nov 2003 17:23:19 -0500, "Sylvain Provencher"
<sylvain.provencher@.nobelia.com> wrote:
>Hi again,
>I have paradox table linked in an access database. I want to migrate to SQL.
>Can I link these tables in SQL ?
>Thanks
>

Monday, February 20, 2012

Migrating to SQL Server 2005;

Hi all,

I have a Database in SQL Server 2000 with several objects (tables, views , stored procedures , functions ).

Is there any specific procedure or tool by which I could migrate the entire database to SQL Server 2005.

Any help would be appreciated.

Thanks,

Hari Haran ArulmozhiAs far as I have seen, backup/restore works as an upgrade path.