Showing posts with label databases. Show all posts
Showing posts with label databases. Show all posts

Friday, March 23, 2012

I want to use in a stored procedures two databases

I have two database, database1 and database2.
Now I want to write a stored procedure in database1, in this Database I need to make a select statement to a table in database2. It is possible? What is the correct code for this problem?

Can someone help me?SELECT * FROM Database2.dbo.Table1

(assuming they are on the same server, that is).

I want to ''Copy'' 3 tables from an existing DB into a new DB on the same SqlServer instance

Is there a quick way in Management Studio to ... i don't know ... drag and drop or maybe copy and paste or import the 3 tables? (The 2 databases are on the same instance of SqlServer 2005)

-perplexed newbie

AFAIK .. there is no drag & drop or copy paste feature for this in SSMO. If u want only data u can use select *into DB1.DBo.ObjectName from DB1.dbo.Objectname. If you want with exact schema, then script it from DB1 run it in DB2 and then copy the data using insert into statement

Madhu

|||Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables|||

ggciubuc wrote:

Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables

this will cretae a table with only data not with all constraints. To create constratin u have to script it.

Madhu

|||Yes it is and is a normal situation because in a new database in many cases, there are not same relationships between tables. To the other part these constraints can be easy rebuild with Database Diagramssql

Wednesday, March 21, 2012

i want to create database

Hi
i have installed sql server and i didn't find any GUI tool like sqlserver 2000 to create database or list the avilable databases or run sql statements ,,,

can you help me

thanks in advance.

Hi Seco,

You can download Management Studio Express from the SQL Express download page.

Mike

|||Thanks mike for reply

is this tool come with workgroup edition? what it's name or the one you gave me can work with all versions of sql server?

2- how can i make relation between 2 tables ?

thanks in advance.|||

hi,

seco wrote:

Thanks mike for reply

is this tool come with workgroup edition? what it's name or the one you gave me can work with all versions of sql server?

quite, but not really... the "full" editions of SQL Server 2005 provides "SQL Server Management Studio", including futher "wizards" and the like being "the full tool" implementation...

SQL Server Management Studio Express is the "lite" version, available for free...


2- how can i make relation between 2 tables ?

you can use the "Diagram" feature of SQL Server Management Studio Express or, (and you should go that way for learning purpose), you should dig into the Data Definition Language statements like CREATE TABLE or ALTER TABLE statements where you can define this kind of constraint..

regards

|||

You might be interested in the learning resources that I posted in this thread, there are a bunch of videos that teach you how to use the tools and how to create the standard database objects such as tables, views and stored procedures.

Mike

I want to ''Copy'' 3 tables from an existing DB into a new DB on the same SqlServer instance

Is there a quick way in Management Studio to ... i don't know ... drag and drop or maybe copy and paste or import the 3 tables? (The 2 databases are on the same instance of SqlServer 2005)

-perplexed newbie

AFAIK .. there is no drag & drop or copy paste feature for this in SSMO. If u want only data u can use select *into DB1.DBo.ObjectName from DB1.dbo.Objectname. If you want with exact schema, then script it from DB1 run it in DB2 and then copy the data using insert into statement

Madhu

|||Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables|||

ggciubuc wrote:

Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables

this will cretae a table with only data not with all constraints. To create constratin u have to script it.

Madhu

|||Yes it is and is a normal situation because in a new database in many cases, there are not same relationships between tables. To the other part these constraints can be easy rebuild with Database Diagramssql

I want to ''Copy'' 3 tables from an existing DB into a new DB on the same SqlServer instance

Is there a quick way in Management Studio to ... i don't know ... drag and drop or maybe copy and paste or import the 3 tables? (The 2 databases are on the same instance of SqlServer 2005)

-perplexed newbie

AFAIK .. there is no drag & drop or copy paste feature for this in SSMO. If u want only data u can use select *into DB1.DBo.ObjectName from DB1.dbo.Objectname. If you want with exact schema, then script it from DB1 run it in DB2 and then copy the data using insert into statement

Madhu

|||Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables|||

ggciubuc wrote:

Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables

this will cretae a table with only data not with all constraints. To create constratin u have to script it.

Madhu

|||Yes it is and is a normal situation because in a new database in many cases, there are not same relationships between tables. To the other part these constraints can be easy rebuild with Database Diagrams

I want to ''Copy'' 3 tables from an existing DB into a new DB on the same SqlServer instance

Is there a quick way in Management Studio to ... i don't know ... drag and drop or maybe copy and paste or import the 3 tables? (The 2 databases are on the same instance of SqlServer 2005)

-perplexed newbie

AFAIK .. there is no drag & drop or copy paste feature for this in SSMO. If u want only data u can use select *into DB1.DBo.ObjectName from DB1.dbo.Objectname. If you want with exact schema, then script it from DB1 run it in DB2 and then copy the data using insert into statement

Madhu

|||Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables|||

ggciubuc wrote:

Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables

this will cretae a table with only data not with all constraints. To create constratin u have to script it.

Madhu

|||Yes it is and is a normal situation because in a new database in many cases, there are not same relationships between tables. To the other part these constraints can be easy rebuild with Database Diagrams

I want to ''Copy'' 3 tables from an existing DB into a new DB on the same SqlServer instance

Is there a quick way in Management Studio to ... i don't know ... drag and drop or maybe copy and paste or import the 3 tables? (The 2 databases are on the same instance of SqlServer 2005)

-perplexed newbie

AFAIK .. there is no drag & drop or copy paste feature for this in SSMO. If u want only data u can use select *into DB1.DBo.ObjectName from DB1.dbo.Objectname. If you want with exact schema, then script it from DB1 run it in DB2 and then copy the data using insert into statement

Madhu

|||Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables|||

ggciubuc wrote:

Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables

this will cretae a table with only data not with all constraints. To create constratin u have to script it.

Madhu

|||Yes it is and is a normal situation because in a new database in many cases, there are not same relationships between tables. To the other part these constraints can be easy rebuild with Database Diagrams

I want to ''Copy'' 3 tables from an existing DB into a new DB on the same SqlServer instance

Is there a quick way in Management Studio to ... i don't know ... drag and drop or maybe copy and paste or import the 3 tables? (The 2 databases are on the same instance of SqlServer 2005)

-perplexed newbie

AFAIK .. there is no drag & drop or copy paste feature for this in SSMO. If u want only data u can use select *into DB1.DBo.ObjectName from DB1.dbo.Objectname. If you want with exact schema, then script it from DB1 run it in DB2 and then copy the data using insert into statement

Madhu

|||Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables|||

ggciubuc wrote:

Right click on first db->Tasks->Export data... and you will go in an easy way to copy your tables

this will cretae a table with only data not with all constraints. To create constratin u have to script it.

Madhu

|||Yes it is and is a normal situation because in a new database in many cases, there are not same relationships between tables. To the other part these constraints can be easy rebuild with Database Diagrams

Monday, March 19, 2012

I want separate data sources for 1 RDL file

Hello all,
Here's my situation:
I have a single RDL file that describes a certain report.
I have different databases on different computers with the same tables
but different data in each table.
I need people to go to each computer, run the same RDL file, but have
it show the data that is specific to their database.
For instance, there is a single .rdl file which describes a personnel
report, and i want people at site A to only see info about site A's
personnel, and people at site B to only see info about site B's
personnel.
Is this possible? If so, is there any advice you can give me to help do
this? Thank you.
Kevin Green
Software Engineer
Pragmatech SoftwareOn each computer have an rds file specifying the connection properties for
that computer.
"KevinGreen24@.gmail.com" wrote:
> Hello all,
> Here's my situation:
> I have a single RDL file that describes a certain report.
> I have different databases on different computers with the same tables
> but different data in each table.
> I need people to go to each computer, run the same RDL file, but have
> it show the data that is specific to their database.
> For instance, there is a single .rdl file which describes a personnel
> report, and i want people at site A to only see info about site A's
> personnel, and people at site B to only see info about site B's
> personnel.
> Is this possible? If so, is there any advice you can give me to help do
> this? Thank you.
> Kevin Green
> Software Engineer
> Pragmatech Software
>|||Well we're working of a SaaS model, so every end user is running a thin
client, so we're not installing anything on the end user's computer.
magendo_man wrote:
> On each computer have an rds file specifying the connection properties for
> that computer.
> "KevinGreen24@.gmail.com" wrote:
> > Hello all,
> >
> > Here's my situation:
> >
> > I have a single RDL file that describes a certain report.
> >
> > I have different databases on different computers with the same tables
> > but different data in each table.
> >
> > I need people to go to each computer, run the same RDL file, but have
> > it show the data that is specific to their database.
> >
> > For instance, there is a single .rdl file which describes a personnel
> > report, and i want people at site A to only see info about site A's
> > personnel, and people at site B to only see info about site B's
> > personnel.
> >
> > Is this possible? If so, is there any advice you can give me to help do
> > this? Thank you.
> >
> > Kevin Green
> > Software Engineer
> > Pragmatech Software
> >
> >|||Are the databases on two different SQL servers? How do the users run the
report? From Report Manager, or embedded in a web page?
If they are running the reports from Report Manager on different servers
then you need to set up data sources (i.e. rds files) on each, with the same
name, but pointing to the site-specific database.
"KevinGreen24@.gmail.com" wrote:
> Well we're working of a SaaS model, so every end user is running a thin
> client, so we're not installing anything on the end user's computer.
> magendo_man wrote:
> > On each computer have an rds file specifying the connection properties for
> > that computer.
> >
> > "KevinGreen24@.gmail.com" wrote:
> >
> > > Hello all,
> > >
> > > Here's my situation:
> > >
> > > I have a single RDL file that describes a certain report.
> > >
> > > I have different databases on different computers with the same tables
> > > but different data in each table.
> > >
> > > I need people to go to each computer, run the same RDL file, but have
> > > it show the data that is specific to their database.
> > >
> > > For instance, there is a single .rdl file which describes a personnel
> > > report, and i want people at site A to only see info about site A's
> > > personnel, and people at site B to only see info about site B's
> > > personnel.
> > >
> > > Is this possible? If so, is there any advice you can give me to help do
> > > this? Thank you.
> > >
> > > Kevin Green
> > > Software Engineer
> > > Pragmatech Software
> > >
> > >
>|||Also in RS 2005 you can dynamically change the datasource based on the user.
I haven't done this but it is one of the capabilities.
Bruce Loehle-Conger
"magendo_man" <magendoman@.discussions.microsoft.com> wrote in message
news:BCD91F31-A84B-40D2-8B00-2FB36C53CD52@.microsoft.com...
> Are the databases on two different SQL servers? How do the users run the
> report? From Report Manager, or embedded in a web page?
> If they are running the reports from Report Manager on different servers
> then you need to set up data sources (i.e. rds files) on each, with the
> same
> name, but pointing to the site-specific database.
> "KevinGreen24@.gmail.com" wrote:
>> Well we're working of a SaaS model, so every end user is running a thin
>> client, so we're not installing anything on the end user's computer.
>> magendo_man wrote:
>> > On each computer have an rds file specifying the connection properties
>> > for
>> > that computer.
>> >
>> > "KevinGreen24@.gmail.com" wrote:
>> >
>> > > Hello all,
>> > >
>> > > Here's my situation:
>> > >
>> > > I have a single RDL file that describes a certain report.
>> > >
>> > > I have different databases on different computers with the same
>> > > tables
>> > > but different data in each table.
>> > >
>> > > I need people to go to each computer, run the same RDL file, but have
>> > > it show the data that is specific to their database.
>> > >
>> > > For instance, there is a single .rdl file which describes a personnel
>> > > report, and i want people at site A to only see info about site A's
>> > > personnel, and people at site B to only see info about site B's
>> > > personnel.
>> > >
>> > > Is this possible? If so, is there any advice you can give me to help
>> > > do
>> > > this? Thank you.
>> > >
>> > > Kevin Green
>> > > Software Engineer
>> > > Pragmatech Software
>> > >
>> > >
>>|||We host 1 report server which each client browser will access. We host
1 database server which has databases which hold the information for
each company that uses our product. So basically we host the data for
each company and we host the report server.
Each client browser will connect to the report server, and at that time
the appropriate company database will be accessed and the information
retrieved, along with the common .rdl file, and the appropriate report
rendered.
So there's 1 .rdl file which describes the form of the report, and
there are N databases for the N companies that use the product, which
hold the data. I need the 1 .rdl file to be able to display information
from any of the N databases that we have, based on the company that's
trying to access the report.
Does this make sense?
magendo_man wrote:
> Are the databases on two different SQL servers? How do the users run the
> report? From Report Manager, or embedded in a web page?
> If they are running the reports from Report Manager on different servers
> then you need to set up data sources (i.e. rds files) on each, with the same
> name, but pointing to the site-specific database.
> "KevinGreen24@.gmail.com" wrote:
> > Well we're working of a SaaS model, so every end user is running a thin
> > client, so we're not installing anything on the end user's computer.
> >
> > magendo_man wrote:
> > > On each computer have an rds file specifying the connection properties for
> > > that computer.
> > >
> > > "KevinGreen24@.gmail.com" wrote:
> > >
> > > > Hello all,
> > > >
> > > > Here's my situation:
> > > >
> > > > I have a single RDL file that describes a certain report.
> > > >
> > > > I have different databases on different computers with the same tables
> > > > but different data in each table.
> > > >
> > > > I need people to go to each computer, run the same RDL file, but have
> > > > it show the data that is specific to their database.
> > > >
> > > > For instance, there is a single .rdl file which describes a personnel
> > > > report, and i want people at site A to only see info about site A's
> > > > personnel, and people at site B to only see info about site B's
> > > > personnel.
> > > >
> > > > Is this possible? If so, is there any advice you can give me to help do
> > > > this? Thank you.
> > > >
> > > > Kevin Green
> > > > Software Engineer
> > > > Pragmatech Software
> > > >
> > > >
> >
> >|||That's exactly what i need, but i can't figure out how!
It also has to be secure of course.
Bruce L-C [MVP] wrote:
> Also in RS 2005 you can dynamically change the datasource based on the user.
> I haven't done this but it is one of the capabilities.
> Bruce Loehle-Conger
> "magendo_man" <magendoman@.discussions.microsoft.com> wrote in message
> news:BCD91F31-A84B-40D2-8B00-2FB36C53CD52@.microsoft.com...
> > Are the databases on two different SQL servers? How do the users run the
> > report? From Report Manager, or embedded in a web page?
> >
> > If they are running the reports from Report Manager on different servers
> > then you need to set up data sources (i.e. rds files) on each, with the
> > same
> > name, but pointing to the site-specific database.
> >
> > "KevinGreen24@.gmail.com" wrote:
> >
> >> Well we're working of a SaaS model, so every end user is running a thin
> >> client, so we're not installing anything on the end user's computer.
> >>
> >> magendo_man wrote:
> >> > On each computer have an rds file specifying the connection properties
> >> > for
> >> > that computer.
> >> >
> >> > "KevinGreen24@.gmail.com" wrote:
> >> >
> >> > > Hello all,
> >> > >
> >> > > Here's my situation:
> >> > >
> >> > > I have a single RDL file that describes a certain report.
> >> > >
> >> > > I have different databases on different computers with the same
> >> > > tables
> >> > > but different data in each table.
> >> > >
> >> > > I need people to go to each computer, run the same RDL file, but have
> >> > > it show the data that is specific to their database.
> >> > >
> >> > > For instance, there is a single .rdl file which describes a personnel
> >> > > report, and i want people at site A to only see info about site A's
> >> > > personnel, and people at site B to only see info about site B's
> >> > > personnel.
> >> > >
> >> > > Is this possible? If so, is there any advice you can give me to help
> >> > > do
> >> > > this? Thank you.
> >> > >
> >> > > Kevin Green
> >> > > Software Engineer
> >> > > Pragmatech Software
> >> > >
> >> > >
> >>
> >>|||The below is from help. Note that they show using a parameter but you could
also use the result of a query that uses the global variable for user (I
believe it is User!Username). Have a table that provides the mapping from
user to database.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
>>>>>>>>
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/rptsrvr9/html/4d8f0ae1-102b-4b3d-9155-fa584c962c9e.htm
Data Source Expressions
Data source expressions are processed at run time or when a report is
previewed. The expression must be written in Visual Basic. Use the following
guidelines when defining a data source expression:
a.. Design the report using a static connection string. A static
connection string refers to a connection string that is not set through an
expression (for example, when you follow the steps for creating a
report-specific or shared data source, you are defining a static connection
string). Using a static connection string allows you to connect to the data
source in Report Designer so that you can get the query results you need to
create the report.
b.. When defining the data source connection, do not use a shared data
source. You cannot use a data source expression in a shared data source. You
must define a report-specific data source for the report.
c.. Specify credentials separately from the connection string. You can use
stored credentials, prompted credentials, or integrated security.
d.. Add a report parameter to specify a data source. For parameter values,
you can either provide a static list of available values (in this case, the
available values should be data sources you can use with the report) or
define a query that retrieves a list of data sources at run time.
e.. Be sure that the list of data sources share the same database schema.
All report design begins with schema information. If there is a mismatch
between the schema used to define the report and the actual schema used by
the report at run time, the report might not run.
f.. Before publishing the report, replace the static connection string
with an expression. Wait until you are finished designing the report before
you replace the static connection string with an expression. Once you use an
expression, you cannot execute the query in Report Designer. Furthermore,
the field list in the Datasets window and the Parameters list will not
update automatically.
>>>>>>>>>
<KevinGreen24@.gmail.com> wrote in message
news:1153261522.566759.269720@.h48g2000cwc.googlegroups.com...
> That's exactly what i need, but i can't figure out how!
> It also has to be secure of course.
> Bruce L-C [MVP] wrote:
>> Also in RS 2005 you can dynamically change the datasource based on the
>> user.
>> I haven't done this but it is one of the capabilities.
>> Bruce Loehle-Conger
>> "magendo_man" <magendoman@.discussions.microsoft.com> wrote in message
>> news:BCD91F31-A84B-40D2-8B00-2FB36C53CD52@.microsoft.com...
>> > Are the databases on two different SQL servers? How do the users run
>> > the
>> > report? From Report Manager, or embedded in a web page?
>> >
>> > If they are running the reports from Report Manager on different
>> > servers
>> > then you need to set up data sources (i.e. rds files) on each, with the
>> > same
>> > name, but pointing to the site-specific database.
>> >
>> > "KevinGreen24@.gmail.com" wrote:
>> >
>> >> Well we're working of a SaaS model, so every end user is running a
>> >> thin
>> >> client, so we're not installing anything on the end user's computer.
>> >>
>> >> magendo_man wrote:
>> >> > On each computer have an rds file specifying the connection
>> >> > properties
>> >> > for
>> >> > that computer.
>> >> >
>> >> > "KevinGreen24@.gmail.com" wrote:
>> >> >
>> >> > > Hello all,
>> >> > >
>> >> > > Here's my situation:
>> >> > >
>> >> > > I have a single RDL file that describes a certain report.
>> >> > >
>> >> > > I have different databases on different computers with the same
>> >> > > tables
>> >> > > but different data in each table.
>> >> > >
>> >> > > I need people to go to each computer, run the same RDL file, but
>> >> > > have
>> >> > > it show the data that is specific to their database.
>> >> > >
>> >> > > For instance, there is a single .rdl file which describes a
>> >> > > personnel
>> >> > > report, and i want people at site A to only see info about site
>> >> > > A's
>> >> > > personnel, and people at site B to only see info about site B's
>> >> > > personnel.
>> >> > >
>> >> > > Is this possible? If so, is there any advice you can give me to
>> >> > > help
>> >> > > do
>> >> > > this? Thank you.
>> >> > >
>> >> > > Kevin Green
>> >> > > Software Engineer
>> >> > > Pragmatech Software
>> >> > >
>> >> > >
>> >>
>> >>
>|||Right. That's similar what I did to solve the problem this morning:
1. Create the master .rdl file that has a hidden parameter called
"DbName"
2. Make the connection string in the data source dynamic:
="Data Source=(local);Initial Catalog=" & Parameters!DbName.Value
3. Create a linked report(s)
4. Using the report manager, set the default value of DbName according
to the company that will own each linked report.
This way, the parameter can be set for the report based on the company
it belongs to, and it's also secure because role-based security can be
set up at the linked report level.
Bruce L-C [MVP] wrote:
> The below is from help. Note that they show using a parameter but you could
> also use the result of a query that uses the global variable for user (I
> believe it is User!Username). Have a table that provides the mapping from
> user to database.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> >>>>>>>>
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/rptsrvr9/html/4d8f0ae1-102b-4b3d-9155-fa584c962c9e.htm
> Data Source Expressions
> Data source expressions are processed at run time or when a report is
> previewed. The expression must be written in Visual Basic. Use the following
> guidelines when defining a data source expression:
> a.. Design the report using a static connection string. A static
> connection string refers to a connection string that is not set through an
> expression (for example, when you follow the steps for creating a
> report-specific or shared data source, you are defining a static connection
> string). Using a static connection string allows you to connect to the data
> source in Report Designer so that you can get the query results you need to
> create the report.
>
> b.. When defining the data source connection, do not use a shared data
> source. You cannot use a data source expression in a shared data source. You
> must define a report-specific data source for the report.
>
> c.. Specify credentials separately from the connection string. You can use
> stored credentials, prompted credentials, or integrated security.
>
> d.. Add a report parameter to specify a data source. For parameter values,
> you can either provide a static list of available values (in this case, the
> available values should be data sources you can use with the report) or
> define a query that retrieves a list of data sources at run time.
>
> e.. Be sure that the list of data sources share the same database schema.
> All report design begins with schema information. If there is a mismatch
> between the schema used to define the report and the actual schema used by
> the report at run time, the report might not run.
>
> f.. Before publishing the report, replace the static connection string
> with an expression. Wait until you are finished designing the report before
> you replace the static connection string with an expression. Once you use an
> expression, you cannot execute the query in Report Designer. Furthermore,
> the field list in the Datasets window and the Parameters list will not
> update automatically.
> >>>>>>>>>
> <KevinGreen24@.gmail.com> wrote in message
> news:1153261522.566759.269720@.h48g2000cwc.googlegroups.com...
> > That's exactly what i need, but i can't figure out how!
> >
> > It also has to be secure of course.
> >
> > Bruce L-C [MVP] wrote:
> >> Also in RS 2005 you can dynamically change the datasource based on the
> >> user.
> >>
> >> I haven't done this but it is one of the capabilities.
> >>
> >> Bruce Loehle-Conger
> >>
> >> "magendo_man" <magendoman@.discussions.microsoft.com> wrote in message
> >> news:BCD91F31-A84B-40D2-8B00-2FB36C53CD52@.microsoft.com...
> >> > Are the databases on two different SQL servers? How do the users run
> >> > the
> >> > report? From Report Manager, or embedded in a web page?
> >> >
> >> > If they are running the reports from Report Manager on different
> >> > servers
> >> > then you need to set up data sources (i.e. rds files) on each, with the
> >> > same
> >> > name, but pointing to the site-specific database.
> >> >
> >> > "KevinGreen24@.gmail.com" wrote:
> >> >
> >> >> Well we're working of a SaaS model, so every end user is running a
> >> >> thin
> >> >> client, so we're not installing anything on the end user's computer.
> >> >>
> >> >> magendo_man wrote:
> >> >> > On each computer have an rds file specifying the connection
> >> >> > properties
> >> >> > for
> >> >> > that computer.
> >> >> >
> >> >> > "KevinGreen24@.gmail.com" wrote:
> >> >> >
> >> >> > > Hello all,
> >> >> > >
> >> >> > > Here's my situation:
> >> >> > >
> >> >> > > I have a single RDL file that describes a certain report.
> >> >> > >
> >> >> > > I have different databases on different computers with the same
> >> >> > > tables
> >> >> > > but different data in each table.
> >> >> > >
> >> >> > > I need people to go to each computer, run the same RDL file, but
> >> >> > > have
> >> >> > > it show the data that is specific to their database.
> >> >> > >
> >> >> > > For instance, there is a single .rdl file which describes a
> >> >> > > personnel
> >> >> > > report, and i want people at site A to only see info about site
> >> >> > > A's
> >> >> > > personnel, and people at site B to only see info about site B's
> >> >> > > personnel.
> >> >> > >
> >> >> > > Is this possible? If so, is there any advice you can give me to
> >> >> > > help
> >> >> > > do
> >> >> > > this? Thank you.
> >> >> > >
> >> >> > > Kevin Green
> >> >> > > Software Engineer
> >> >> > > Pragmatech Software
> >> >> > >
> >> >> > >
> >> >>
> >> >>
> >

Friday, March 9, 2012

I need to use different databases in a SP

i am sending a database name to a SP , i need that the SP executes some
statements over that database, can anyone help me to fin how can i do this?"Dario Morales" <dmorales@.trfe.org.mx> wrote in message
news:uPBmdFsaFHA.2980@.TK2MSFTNGP10.phx.gbl...
> i am sending a database name to a SP , i need that the SP executes some
> statements over that database, can anyone help me to fin how can i do
this?
>
You could use Dynamic SQL.
CREATE PROC Foo
@.dbname sysname
AS
-- Does some work using Dynamic SQL
BEGIN
DECLARE @.sql varchar(4000)
SET @.sql = 'SELECT col1, col2, col3 FROM ' + @.dbname + '.dbo.Table1'
EXECUTE (@.sql)
END
This is just a start.
Rick Sawtell|||You can use 3-part naming directly in a stored procedure, as anywhere else:
SELECT *
FROM database.owner.object ...
If you are passing the database name as a parameter:
DECLARE @.storedproc
SET @.storedproc = @.db + '..some_sp'
EXEC @.storedproc @.param1, @.param2...
And of course you can use Dynamic SQL where you can use EXEC or
sp_ExecuteSQL to execute a dynamically built string within a stored
procedure. But make sure you have sufficient precautions taken against
potential security risks and injection.
Anith

I need to select database name from sysdatabases & make dynamic 'u

I am trying to make a dynamic 'use' statement so that some code can loop
through the databases listed in sysdatabases, pull the name and place it into
a variable after the 'use ' keyword. My test code thus far looks like this:
begin
declare @.db_name varchar(200)
declare @.codevarchar(200)
set @.db_name = 'nic_int_ldr'
select @.code = 'use ' + rtrim(ltrim(@.db_name))
print @.code
exec (@.code)
--use nic_int_ldr
select max(id_bat) from ldr_batch
end
At this point I'm just trying to get it to work with a hard coded database
name and I can't even get that to go.
Is it not possible to make a 'use ' statement work this way?
Thanks,
John Miceli
Use is local to a batch, and EXEC is effectively a batch. Put all the thing you want to execute
inside the same EXEC.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"John Miceli, MCDBA" <JohnMiceliMCDBA@.discussions.microsoft.com> wrote in message
news:AA82D9E1-715C-4AE4-B69D-901E989763A5@.microsoft.com...
>I am trying to make a dynamic 'use' statement so that some code can loop
> through the databases listed in sysdatabases, pull the name and place it into
> a variable after the 'use ' keyword. My test code thus far looks like this:
> ----
> begin
> declare @.db_name varchar(200)
> declare @.code varchar(200)
> set @.db_name = 'nic_int_ldr'
> select @.code = 'use ' + rtrim(ltrim(@.db_name))
> print @.code
> exec (@.code)
> --use nic_int_ldr
> select max(id_bat) from ldr_batch
> end
> ----
> At this point I'm just trying to get it to work with a hard coded database
> name and I can't even get that to go.
> Is it not possible to make a 'use ' statement work this way?
> Thanks,
> John Miceli

I need to select database name from sysdatabases & make dynamic 'u

I am trying to make a dynamic 'use' statement so that some code can loop
through the databases listed in sysdatabases, pull the name and place it into
a variable after the 'use ' keyword. My test code thus far looks like this:
----
begin
declare @.db_name varchar(200)
declare @.code varchar(200)
set @.db_name = 'nic_int_ldr'
select @.code = 'use ' + rtrim(ltrim(@.db_name))
print @.code
exec (@.code)
--use nic_int_ldr
select max(id_bat) from ldr_batch
en
----
At this point I'm just trying to get it to work with a hard coded database
name and I can't even get that to go.
Is it not possible to make a 'use ' statement work this way?
Thanks,
John MiceliUse is local to a batch, and EXEC is effectively a batch. Put all the thing you want to execute
inside the same EXEC.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"John Miceli, MCDBA" <JohnMiceliMCDBA@.discussions.microsoft.com> wrote in message
news:AA82D9E1-715C-4AE4-B69D-901E989763A5@.microsoft.com...
>I am trying to make a dynamic 'use' statement so that some code can loop
> through the databases listed in sysdatabases, pull the name and place it into
> a variable after the 'use ' keyword. My test code thus far looks like this:
> ----
> begin
> declare @.db_name varchar(200)
> declare @.code varchar(200)
> set @.db_name = 'nic_int_ldr'
> select @.code = 'use ' + rtrim(ltrim(@.db_name))
> print @.code
> exec (@.code)
> --use nic_int_ldr
> select max(id_bat) from ldr_batch
> end
> ----
> At this point I'm just trying to get it to work with a hard coded database
> name and I can't even get that to go.
> Is it not possible to make a 'use ' statement work this way?
> Thanks,
> John Miceli|||Thank you Tibor for your response!
If I have to put all of what follows into the same exec, I think I'm going
to have problems because there are multiple, very large queries that have to
run against the same database. Then when the next database cycles through,
the same statements have to be run against each one (10 total).
Do you have any other ideas of how to make that persistent? Thanks again!
"Tibor Karaszi" wrote:
> Use is local to a batch, and EXEC is effectively a batch. Put all the thing you want to execute
> inside the same EXEC.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "John Miceli, MCDBA" <JohnMiceliMCDBA@.discussions.microsoft.com> wrote in message
> news:AA82D9E1-715C-4AE4-B69D-901E989763A5@.microsoft.com...
> >I am trying to make a dynamic 'use' statement so that some code can loop
> > through the databases listed in sysdatabases, pull the name and place it into
> > a variable after the 'use ' keyword. My test code thus far looks like this:
> > ----
> > begin
> > declare @.db_name varchar(200)
> > declare @.code varchar(200)
> >
> > set @.db_name = 'nic_int_ldr'
> > select @.code = 'use ' + rtrim(ltrim(@.db_name))
> > print @.code
> > exec (@.code)
> >
> > --use nic_int_ldr
> > select max(id_bat) from ldr_batch
> > end
> > ----
> > At this point I'm just trying to get it to work with a hard coded database
> > name and I can't even get that to go.
> >
> > Is it not possible to make a 'use ' statement work this way?
> >
> > Thanks,
> > John Miceli
>
>|||> Do you have any other ideas of how to make that persistent?
Not that I can think of, I'm afraid... Sorry :-(
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<John Miceli>; "MCDBA" <jdmiceli@.hotmail.com> wrote in message
news:BA5C17DB-F769-47DA-AF09-7AA414561BBE@.microsoft.com...
> Thank you Tibor for your response!
> If I have to put all of what follows into the same exec, I think I'm going
> to have problems because there are multiple, very large queries that have to
> run against the same database. Then when the next database cycles through,
> the same statements have to be run against each one (10 total).
> Do you have any other ideas of how to make that persistent? Thanks again!
>
> "Tibor Karaszi" wrote:
> > Use is local to a batch, and EXEC is effectively a batch. Put all the thing you want to execute
> > inside the same EXEC.
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
> >
> >
> > "John Miceli, MCDBA" <JohnMiceliMCDBA@.discussions.microsoft.com> wrote in message
> > news:AA82D9E1-715C-4AE4-B69D-901E989763A5@.microsoft.com...
> > >I am trying to make a dynamic 'use' statement so that some code can loop
> > > through the databases listed in sysdatabases, pull the name and place it into
> > > a variable after the 'use ' keyword. My test code thus far looks like this:
> > > ----
> > > begin
> > > declare @.db_name varchar(200)
> > > declare @.code varchar(200)
> > >
> > > set @.db_name = 'nic_int_ldr'
> > > select @.code = 'use ' + rtrim(ltrim(@.db_name))
> > > print @.code
> > > exec (@.code)
> > >
> > > --use nic_int_ldr
> > > select max(id_bat) from ldr_batch
> > > end
> > > ----
> > > At this point I'm just trying to get it to work with a hard coded database
> > > name and I can't even get that to go.
> > >
> > > Is it not possible to make a 'use ' statement work this way?
> > >
> > > Thanks,
> > > John Miceli
> >
> >
> >

I need to select database name from sysdatabases & make dynamic 'u

I am trying to make a dynamic 'use' statement so that some code can loop
through the databases listed in sysdatabases, pull the name and place it int
o
a variable after the 'use ' keyword. My test code thus far looks like this:
----
begin
declare @.db_name varchar(200)
declare @.code varchar(200)
set @.db_name = 'nic_int_ldr'
select @.code = 'use ' + rtrim(ltrim(@.db_name))
print @.code
exec (@.code)
--use nic_int_ldr
select max(id_bat) from ldr_batch
end
----
--
At this point I'm just trying to get it to work with a hard coded database
name and I can't even get that to go.
Is it not possible to make a 'use ' statement work this way?
Thanks,
John MiceliUse is local to a batch, and EXEC is effectively a batch. Put all the thing
you want to execute
inside the same EXEC.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"John Miceli, MCDBA" <JohnMiceliMCDBA@.discussions.microsoft.com> wrote in me
ssage
news:AA82D9E1-715C-4AE4-B69D-901E989763A5@.microsoft.com...
>I am trying to make a dynamic 'use' statement so that some code can loop
> through the databases listed in sysdatabases, pull the name and place it i
nto
> a variable after the 'use ' keyword. My test code thus far looks like thi
s:
> ----
--
> begin
> declare @.db_name varchar(200)
> declare @.code varchar(200)
> set @.db_name = 'nic_int_ldr'
> select @.code = 'use ' + rtrim(ltrim(@.db_name))
> print @.code
> exec (@.code)
> --use nic_int_ldr
> select max(id_bat) from ldr_batch
> end
> ----
--
> At this point I'm just trying to get it to work with a hard coded database
> name and I can't even get that to go.
> Is it not possible to make a 'use ' statement work this way?
> Thanks,
> John Miceli

Wednesday, March 7, 2012

i need to create a report by using 5 databases

let me put it little more deatail,
i'm using crystal report XI,
I have 5 database servers and i need to make a report on the table which is common among all 5 DB's.
sample.
employ,
empnum, empname,.......
pls some one help me out hereIf all databases exist on the same server, then you can reference the tables directly and do joins on them like this:

select ....
from DB1.dbo.Table1 AS d1t1
inner join DB2.dbo.Table2 as d2t1 ON d1t1.ID = d2t1.ID
...

What you need to do is create a view, to be used as a table for Crystal Reports. Then when you "select * from" the view, it will query each of the databases as defined in the view.

If the databases exist on a different server, u should consult your administrator about setting up a link. Not all database systems support linked databases. When you query a table from a linked database, expect it to be very very slow, since it has to copy the tabledata across the network before the join can begin.. so depending on the query, u may end up copying the whole table from each database, as temporary data, every time the report executes.

To speed this up, you could replicate the necessary data into the report database, either with some kind of replicator or by scheduling a daily process to get the new data to be used. Then its a local table you are querying or joining against.

Does this answer your question?

Sunday, February 19, 2012

I need BETWEEN on speed

This is x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming

I have events that occur during the day. I want to be able to search those
by a form with checkboxes (multiple select).

Let's say for instance an event is happening from 3-10pm. When someone
searches for 4-6 (checkbox option) it needs to show up.

I don't need code so much as I just need theory. My theory that I coded out
and worked, just a missight in theory is as follows. I did a BETWEEN call
that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
As you can see. The event spans that time, but does not start or stop
between 4 and 6, thus was not pulled. Ooops.

So if someone call tell me of another function or perhaps just a better way
to use BETWEEN that would be great. I don't think that code is necessary at
this juncture, so save the 'Please post code' post :) Thanks.If there is an index on the datetime column, then use >= and < rather than
BETWEEN.

But as soon as you add an OR clause, this might really muck up the plan.

--
http://www.aspfaq.com/
(Reverse address to reply.)

"Rizyak" <ryanREMOVEME@.latitude47.comANDMETOO> wrote in message
news:cbs9ag$3go$1@.gnus01.u.washington.edu...
> This is x-posted in:
> alt.php.sql
> comp.databases.ms-sqlserver
> microsoft.public.sqlserver.programming
> I have events that occur during the day. I want to be able to search those
> by a form with checkboxes (multiple select).
> Let's say for instance an event is happening from 3-10pm. When someone
> searches for 4-6 (checkbox option) it needs to show up.
> I don't need code so much as I just need theory. My theory that I coded
out
> and worked, just a missight in theory is as follows. I did a BETWEEN call
> that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
> As you can see. The event spans that time, but does not start or stop
> between 4 and 6, thus was not pulled. Ooops.
> So if someone call tell me of another function or perhaps just a better
way
> to use BETWEEN that would be great. I don't think that code is necessary
at
> this juncture, so save the 'Please post code' post :) Thanks.|||starttime <= 6 AND endtime >= 4

--
Jacco Schalkwijk
SQL Server MVP

"Rizyak" <ryanREMOVEME@.latitude47.comANDMETOO> wrote in message
news:cbs9ag$3go$1@.gnus01.u.washington.edu...
> This is x-posted in:
> alt.php.sql
> comp.databases.ms-sqlserver
> microsoft.public.sqlserver.programming
> I have events that occur during the day. I want to be able to search those
> by a form with checkboxes (multiple select).
> Let's say for instance an event is happening from 3-10pm. When someone
> searches for 4-6 (checkbox option) it needs to show up.
> I don't need code so much as I just need theory. My theory that I coded
out
> and worked, just a missight in theory is as follows. I did a BETWEEN call
> that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
> As you can see. The event spans that time, but does not start or stop
> between 4 and 6, thus was not pulled. Ooops.
> So if someone call tell me of another function or perhaps just a better
way
> to use BETWEEN that would be great. I don't think that code is necessary
at
> this juncture, so save the 'Please post code' post :) Thanks.|||Rizyak,

EventStartTime <= BetweenEndTime
AND
EventEndTime >= BetweenStartTime

Russell Fields
"Rizyak" <ryanREMOVEME@.latitude47.comANDMETOO> wrote in message
news:cbs9ag$3go$1@.gnus01.u.washington.edu...
> This is x-posted in:
> alt.php.sql
> comp.databases.ms-sqlserver
> microsoft.public.sqlserver.programming
> I have events that occur during the day. I want to be able to search those
> by a form with checkboxes (multiple select).
> Let's say for instance an event is happening from 3-10pm. When someone
> searches for 4-6 (checkbox option) it needs to show up.
> I don't need code so much as I just need theory. My theory that I coded
out
> and worked, just a missight in theory is as follows. I did a BETWEEN call
> that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
> As you can see. The event spans that time, but does not start or stop
> between 4 and 6, thus was not pulled. Ooops.
> So if someone call tell me of another function or perhaps just a better
way
> to use BETWEEN that would be great. I don't think that code is necessary
at
> this juncture, so save the 'Please post code' post :) Thanks.|||Assuming an event is selected if it was busy at least part of the time
during the search window...

Select events from table where
(EventStartTime between WindowStartTime and WindowsEnd Time) or
(EventEndTime between WindowStartTime and WindowsEnd Time) or
(EventStartTime <= WindowsStartime and EventEndTime >= WindowEndTime)

"Rizyak" <ryanREMOVEME@.latitude47.comANDMETOO> wrote in message
news:cbs9ag$3go$1@.gnus01.u.washington.edu...
> This is x-posted in:
> alt.php.sql
> comp.databases.ms-sqlserver
> microsoft.public.sqlserver.programming
> I have events that occur during the day. I want to be able to search those
> by a form with checkboxes (multiple select).
> Let's say for instance an event is happening from 3-10pm. When someone
> searches for 4-6 (checkbox option) it needs to show up.
> I don't need code so much as I just need theory. My theory that I coded
out
> and worked, just a missight in theory is as follows. I did a BETWEEN call
> that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
> As you can see. The event spans that time, but does not start or stop
> between 4 and 6, thus was not pulled. Ooops.
> So if someone call tell me of another function or perhaps just a better
way
> to use BETWEEN that would be great. I don't think that code is necessary
at
> this juncture, so save the 'Please post code' post :) Thanks.|||"Rizyak" <ryanREMOVEME@.latitude47.comANDMETOO> wrote in message
news:cbs9ag$3go$1@.gnus01.u.washington.edu...
> This is x-posted in:
> alt.php.sql
> comp.databases.ms-sqlserver
> microsoft.public.sqlserver.programming
> I have events that occur during the day. I want to be able to search those
> by a form with checkboxes (multiple select).
> Let's say for instance an event is happening from 3-10pm. When someone
> searches for 4-6 (checkbox option) it needs to show up.
> I don't need code so much as I just need theory. My theory that I coded
out
> and worked, just a missight in theory is as follows. I did a BETWEEN call
> that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
> As you can see. The event spans that time, but does not start or stop
> between 4 and 6, thus was not pulled. Ooops.
> So if someone call tell me of another function or perhaps just a better
way
> to use BETWEEN that would be great. I don't think that code is necessary
at
> this juncture, so save the 'Please post code' post :) Thanks.

SELECT
<field list>
FROM
Events AS E
WHERE
E.Begin_Time < '2004-06-29T18:00:00.000' AND
E.End_Time > '2004-06-29T16:00:00.000'

In the future, please provide DDL, sample data and desired output.|||This works. Thank you.

"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wrote
in message news:%23Kr8lEgXEHA.3676@.TK2MSFTNGP09.phx.gbl...
> starttime <= 6 AND endtime >= 4
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Rizyak" <ryanREMOVEME@.latitude47.comANDMETOO> wrote in message
> news:cbs9ag$3go$1@.gnus01.u.washington.edu...
> > This is x-posted in:
> > alt.php.sql
> > comp.databases.ms-sqlserver
> > microsoft.public.sqlserver.programming
> > I have events that occur during the day. I want to be able to search
those
> > by a form with checkboxes (multiple select).
> > Let's say for instance an event is happening from 3-10pm. When someone
> > searches for 4-6 (checkbox option) it needs to show up.
> > I don't need code so much as I just need theory. My theory that I coded
> out
> > and worked, just a missight in theory is as follows. I did a BETWEEN
call
> > that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND
6.
> > As you can see. The event spans that time, but does not start or stop
> > between 4 and 6, thus was not pulled. Ooops.
> > So if someone call tell me of another function or perhaps just a better
> way
> > to use BETWEEN that would be great. I don't think that code is necessary
> at
> > this juncture, so save the 'Please post code' post :) Thanks.|||>>I don't need code so much as I just need theory. <<

Theory? Okay! Draw a picture of a time-line. When do two duration
NOT overlap? When T1 begins after T2 ends and when T1 ends before T2
begins. Therefore, When do two duration overlap? When they do not not
overlap!

Another trick is to use a NULL for "eternity" and then write
COALESCE (finish_date, CURRENT_TIMESTAMP) in your queries.|||--CELKO-- (jcelko212@.earthlink.net) writes:
> Another trick is to use a NULL for "eternity" and then write
> COALESCE (finish_date, CURRENT_TIMESTAMP) in your queries.

I don't know what you are thinking of here, but when I have an open
time interval, I rather use '99991231' than CURRENT_TIMESTAMP. If the
interval you are comparing with is partly in the future, CURRENT_TIMESTAMP
might not give the correct results.

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||>> ... when I have an open time interval, I rather use '99991231' than
CURRENT_TIMESTAMP. <<

If I have an event that is still in progress, such as checking into a
hotel, then the only real knowledge I have is that Mr. X is still here,
right now. I can figure out his current bill, etc. in a simple VIEW.
The NULL is easy to spot and to handle for this purpose.

If you use a dummy date, then you need to be sure that:

1) you always use extra code to handle it correctly in calculations and
queries.

2) And what if your personnal choice for a dummy date is an actual value
in the data? Look at all the SQL Server programs that assume the world
began in 1900 because of converting a zero to a datetime.

3) Dummy dates do not port very well; Oracle can store BCE dates, DB2
has a greater range, etc.

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!|||Joe Celko (jcelko212@.earthlink.net) writes:
>>> ... when I have an open time interval, I rather use '99991231' than
> CURRENT_TIMESTAMP. <<
> If I have an event that is still in progress, such as checking into a
> hotel, then the only real knowledge I have is that Mr. X is still here,
> right now. I can figure out his current bill, etc. in a simple VIEW.
> The NULL is easy to spot and to handle for this purpose.

Agreed, I don't question that part. What I meant to say is that

SELECT *
FROM tbl
WHERE coalesce(enddate, CURRENT_TIMESTAMP) > @.stopdate

could give in correct result, if both @.stopdate and endate are in
the future. (Say for instance that tbl holds contracts that can be
open-ended, but also have future date at which they expire. Thus
I would rather write that as:

SELECT *
FROM tbl
WHERE coalesce(enddate, '99991231') > @.stopdate

(Note: the above is for performance reasons better written as
enddate IS NULL OR enddate > @.stopdate in SQL Server.)

Using special values to mean something is certainly not good practice,
because if you forgot if you used 99991231 or 21010101 or whatever, you
may get the wrong result.

> If you use a dummy date, then you need to be sure that:

Agreed on all your points.

I have to admit that I have committed the sin at least once. I have
a table cross-currency pairs, and there is a column fixedfrom which
tells you from which date the currency rate for this pair has been
fixed. In practice there are three(*) possible values: NULL (the rate
is not fixed), 19990101 DEM/EUR, ITL/EUR etc and 17530101 for
SEK/SEK, USD/USD etc. In this case NULL was not available to mean
"has always been". (Of course, I could have added an extra column
which would have specified that fixedfrom had any meaning at all,
but was less appetizing. Even if that is the way it looks in the GUI.)

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||********************
alt.php.sql,comp
databases.ms-sqlserver
microsoft.public.sqlserver.programming
***********************************

Why doesn't this work:

SELECT *
FROM 'Events'
WHERE dayofweek
REGEXP 'monday' OR description REGEXP 'monday'

Just so you know, this does work:
SELECT *
FROM `Events`
WHERE dayofweek
REGEXP 'monday'|||Rizyak (ryanREMOVEME@.latitude47.comANDMETOO) writes:
> ********************
> alt.php.sql,comp
> databases.ms-sqlserver
> microsoft.public.sqlserver.programming
> ***********************************
> Why doesn't this work:
> SELECT *
> FROM 'Events'
> WHERE dayofweek
> REGEXP 'monday' OR description REGEXP 'monday'
> Just so you know, this does work:
> SELECT *
> FROM `Events`
> WHERE dayofweek
> REGEXP 'monday'

Not that I know what you are talking about, because there are several
errors in both samples as far as SQL Server is concerned.

However, I like to point out a general issue: don't just say "does not
work", but specify. Do you get an error message? Do you get unexpected
results.

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

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