Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Friday, March 23, 2012

how to run queries??

Hi,

I am using visual web developer2005 express edition and finding hard time to get my query run in this i am making my own login page as i have few more things to ask to user before they get logged in so i am not using the login control.

i want to write my own querywithout help ofsqlDataSource control from start something like

sqldatasource con=new sqldatasource;

con.connection String=""

then what all things will come...... ?

and please give me some poitners to some articles which help one to do the requested.

Regards,

Please checkheresql

How to run queries in SQL Server using Access files

Hello All,
I am new to SQL Server. I have an Access database and I want o run SQL
queries in SQL Server. I have alredy run SQL queries using this database in
Access but cant do it in SQL Server. Can someone advise?
Neeraj
Yes of course. You have to setup the access database as a linked server or
have to use the OPENROWSET or OPENDATASOURCE. I like working with linked
server if you use they permanently. You can access them via the four-part
name schema naming the object as below:
Select * from LinkedServername...ObjectName
More on this is on the BOL with some good examples, makes sure that the path
you define in the settings of the Access database is serverbased. so the
access db has to be reached from the server to use it.
Sample:
USE master
GO
-- To use named parameters:
EXEC sp_addlinkedserver
@.server = 'SEATTLE Mktg',
@.provider = 'Microsoft.Jet.OLEDB.4.0',
@.srvproduct = 'OLE DB Provider for Jet',
@.datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
-- OR to use no named parameters:
USE master
GO
EXEC sp_addlinkedserver
'SEATTLE Mktg',
'OLE DB Provider for Jet',
'Microsoft.Jet.OLEDB.4.0',
'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"Neeraj" <Neeraj@.discussions.microsoft.com> schrieb im Newsbeitrag
news:FE0A89AE-C691-4D46-A2F5-CA38A7D161F8@.microsoft.com...
> Hello All,
> I am new to SQL Server. I have an Access database and I want o run SQL
> queries in SQL Server. I have alredy run SQL queries using this database
> in
> Access but cant do it in SQL Server. Can someone advise?
> --
> Neeraj

How to run queries in SQL Server using Access files

Hello All,
I am new to SQL Server. I have an Access database and I want o run SQL
queries in SQL Server. I have alredy run SQL queries using this database in
Access but cant do it in SQL Server. Can someone advise?
--
NeerajYes of course. You have to setup the access database as a linked server or
have to use the OPENROWSET or OPENDATASOURCE. I like working with linked
server if you use they permanently. You can access them via the four-part
name schema naming the object as below:
Select * from LinkedServername...ObjectName
More on this is on the BOL with some good examples, makes sure that the path
you define in the settings of the Access database is serverbased. so the
access db has to be reached from the server to use it.
Sample:
USE master
GO
-- To use named parameters:
EXEC sp_addlinkedserver
@.server = 'SEATTLE Mktg',
@.provider = 'Microsoft.Jet.OLEDB.4.0',
@.srvproduct = 'OLE DB Provider for Jet',
@.datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
-- OR to use no named parameters:
USE master
GO
EXEC sp_addlinkedserver
'SEATTLE Mktg',
'OLE DB Provider for Jet',
'Microsoft.Jet.OLEDB.4.0',
'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"Neeraj" <Neeraj@.discussions.microsoft.com> schrieb im Newsbeitrag
news:FE0A89AE-C691-4D46-A2F5-CA38A7D161F8@.microsoft.com...
> Hello All,
> I am new to SQL Server. I have an Access database and I want o run SQL
> queries in SQL Server. I have alredy run SQL queries using this database
> in
> Access but cant do it in SQL Server. Can someone advise?
> --
> Neeraj

How to run queries in SQL Server using Access files

Hello All,
I am new to SQL Server. I have an Access database and I want o run SQL
queries in SQL Server. I have alredy run SQL queries using this database in
Access but cant do it in SQL Server. Can someone advise?
--
NeerajYes of course. You have to setup the access database as a linked server or
have to use the OPENROWSET or OPENDATASOURCE. I like working with linked
server if you use they permanently. You can access them via the four-part
name schema naming the object as below:
Select * from LinkedServername...ObjectName
More on this is on the BOL with some good examples, makes sure that the path
you define in the settings of the Access database is serverbased. so the
access db has to be reached from the server to use it.
Sample:
USE master
GO
-- To use named parameters:
EXEC sp_addlinkedserver
@.server = 'SEATTLE Mktg',
@.provider = 'Microsoft.Jet.OLEDB.4.0',
@.srvproduct = 'OLE DB Provider for Jet',
@.datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
-- OR to use no named parameters:
USE master
GO
EXEC sp_addlinkedserver
'SEATTLE Mktg',
'OLE DB Provider for Jet',
'Microsoft.Jet.OLEDB.4.0',
'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Neeraj" <Neeraj@.discussions.microsoft.com> schrieb im Newsbeitrag
news:FE0A89AE-C691-4D46-A2F5-CA38A7D161F8@.microsoft.com...
> Hello All,
> I am new to SQL Server. I have an Access database and I want o run SQL
> queries in SQL Server. I have alredy run SQL queries using this database
> in
> Access but cant do it in SQL Server. Can someone advise?
> --
> Neeraj

Wednesday, March 21, 2012

How to run a .sql file in SQL Server 2005 Express Edition.

Hi All,

I have a .sql file withall my queries written in it. Now I want to know, Is it possible to runthis sql file in SQL Server 2005 Express Edition like we can do inOracle? If it is possible then tell me how to do it?

Thanx in advance for any kind of help.

Regards,
Paramhans Dubey.

You can use sqlcmd utility.

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

|||If you've got SQL Server Management Studio (or the Express version which is a free download from Microsoft), then you can use the GUI to open the .sql script in a query window and execute the contents - its all point-and-click.

Friday, March 9, 2012

How to return a set of Data ?

Hello,
I have to make queries on a very big database, bon only part by part.
For example : I would like to use a SELECT request and get only the rows
1000 to 1999.
With the TOP keywork, I can get the 10 first rows. But what is the command
to retrieve the rows between tho numbers ?I would use a generated IDENTITY column in the result set, and then filter
on the IDENTITY value.
Martin
"Florent CORNEILLE" <FlorentCORNEILLE@.discussions.microsoft.com> wrote in
message news:DE105ECC-7FD0-44FA-97C8-AB495BBC7601@.microsoft.com...
> Hello,
> I have to make queries on a very big database, bon only part by part.
> For example : I would like to use a SELECT request and get only the rows
> 1000 to 1999.
> With the TOP keywork, I can get the 10 first rows. But what is the command
> to retrieve the rows between tho numbers ?
>|||-- Try:
SELECT *
FROM <@.your_table, SYSNAME, >
WHERE <@.your_field, SYSNAME, > Between 1000 And 1999
-- This query is formatted as a template, so from Query Analyser, press
Ctrl+Shift+M and fill in the parameters.
-- Lookup "Using Templates in SQL Query Analyzer" in BOL
-- Damien
"Florent CORNEILLE" wrote:

> Hello,
> I have to make queries on a very big database, bon only part by part.
> For example : I would like to use a SELECT request and get only the rows
> 1000 to 1999.
> With the TOP keywork, I can get the 10 first rows. But what is the command
> to retrieve the rows between tho numbers ?
>

Sunday, February 19, 2012

how to restrict SQL running thread

Hi,
We have a big report running on SQLRS2000+SP2. The report has multiple
datasets and queries. When report starts running, the database server it
connects to run query and pull data will start 33 threads and immediately
reach 100% CPU usage for all 8 CPUs. Databases is over 1TB and sets on EMC
SAN. There is no blocking during report generation. There is no sub-report,
so I assume there is only one DB connection.
We are wondering is it possible to restrict the number of threads
instantiated or is it possible to serialize the report generation, only run
1 thread at a time. Please help.
Jasonyou can set the maxdop option in your queries to limit the number of CPU
used during the execution of the query.
select ... from ... option (maxdop 1)
this reduce the number of CPU used in a parrallel query
the maxdop option can be setup at the server level instead-of the query
level; but not recommanded until you suffer performance issues
test the query, reducing the maxdop can reduce the query performance.
if the query takes 1min instead-of 10sec. the user will not be happy!
why its a problem for you if the queries use all the CPU?
"Jason Wang" <aa@.aa.com> wrote in message
news:eSLkGBeRGHA.5108@.TK2MSFTNGP09.phx.gbl...
> Hi,
> We have a big report running on SQLRS2000+SP2. The report has multiple
> datasets and queries. When report starts running, the database server it
> connects to run query and pull data will start 33 threads and immediately
> reach 100% CPU usage for all 8 CPUs. Databases is over 1TB and sets on EMC
> SAN. There is no blocking during report generation. There is no
> sub-report, so I assume there is only one DB connection.
> We are wondering is it possible to restrict the number of threads
> instantiated or is it possible to serialize the report generation, only
> run 1 thread at a time. Please help.
> Jason
>