Friday, March 30, 2012
query a sorted view by rows
or show last 25 rows ?
thanksSam wrote:
> how can I query a sorted view by rows - show rows 50 to 75
> or show last 25 rows ?
> thanks
Views are NOT sorted. If you are using unsupported and unreliable
tricks like TOP 100 PERCENT ... ORDER BY then you'll find that they
break in SQL Server 2005 or maybe even in 2000 under some future fix or
SP.
The solution is to sort when you query the view:
SELECT A1.au_id, A1.au_lname, A1.au_fname
FROM pubs.dbo.authors AS A1
WHERE
(SELECT COUNT(*)
FROM pubs.dbo.authors AS A2
WHERE A1.au_id >= A2.au_id)
BETWEEN 10 AND 15
ORDER BY A1.au_id ;
If you want some more sophisticated paging examples then take a look
at:
http://www.aspfaq.com/show.asp?id=2120
Hope this helps.
David Portas
SQL Server MVP
--|||First of all, there's no need to create an ordered view. Sort your rows when
querying the view, or on the client.
Look up the TOP keyword in Books Online.
http://msdn.microsoft.com/library/d...r />
_13ec.asp
Also lookup RANK(), ROWNUMBER() and DENSE_RANK() in Books Online 2005, if
you're using SQL Server 2005.
http://msdn2.microsoft.com/en-us/library/ms176102.aspx
http://msdn2.microsoft.com/en-us/library/ms186734.aspx
http://msdn2.microsoft.com/en-us/library/ms173825.aspx
In SQL 2000 these functions do not exist, so you could find a paging method
here:
http://www.aspfaq.com/show.asp?id=2427 (and in the rest of the really nice
neighbourhood of aspfaq.com).
ML
Wednesday, March 28, 2012
Query (IMPORTANT)
I would like to query and view returned rows using MSDE.
Can I accomplish this? How about with the bcp.exe utility? How about with
MS-ACCESS?
Thanks,
Yama
I think we need a bit more detail here. There are a ton of examples of
writing queries of all kinds online, in books and magazines. Why won't these
work?
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Yama" <ykamyar@.stbernard.com> wrote in message
news:OzN6mlpmEHA.2500@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I would like to query and view returned rows using MSDE.
> Can I accomplish this? How about with the bcp.exe utility? How about with
> MS-ACCESS?
> Thanks,
> Yama
>
Query
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...
Try:
use master
go
sp_helptext sp_databases
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Prince" <princevictor.moses@.gmail.com> wrote in message
news:1142334055.274265.194010@.i40g2000cwc.googlegr oups.com...
Hai all,
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...
|||Hai..
it works... thanx...
Tom Moreau wrote:
> Try:
> use master
> go
> sp_helptext sp_databases
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Prince" <princevictor.moses@.gmail.com> wrote in message
> news:1142334055.274265.194010@.i40g2000cwc.googlegr oups.com...
> Hai all,
> Is it possible to view the contents in built-in stored procedure
> like sp_databases?
> If possible, can anyone tell how to view it?
> Looking forward or the response...
> Thanx in advance...
Monday, March 26, 2012
Query
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...
Try:
use master
go
sp_helptext sp_databases
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Prince" <princevictor.moses@.gmail.com> wrote in message
news:1142334055.274265.194010@.i40g2000cwc.googlegr oups.com...
Hai all,
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...
|||Hai..
it works... thanx...
Tom Moreau wrote:
> Try:
> use master
> go
> sp_helptext sp_databases
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Prince" <princevictor.moses@.gmail.com> wrote in message
> news:1142334055.274265.194010@.i40g2000cwc.googlegr oups.com...
> Hai all,
> Is it possible to view the contents in built-in stored procedure
> like sp_databases?
> If possible, can anyone tell how to view it?
> Looking forward or the response...
> Thanx in advance...
Friday, March 23, 2012
query
first A
second B
in B there is a table X
how can i save a view in A that select the table X in B?
ThanksYes, but not in the query designer. Write TSQL code instead:
CREATE VIEW ... AS
SELECT ...
FROM otherdb.dbo.tblname
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"killer" <matteo.milano@.katamail.com> wrote in message
news:_u5tb.114858$vO5.4451339@.twister1.libero.it...
> I have 2 database:
> first A
> second B
> in B there is a table X
> how can i save a view in A that select the table X in B?
>
> Thanks
>
Query
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...Try:
use master
go
sp_helptext sp_databases
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Prince" <princevictor.moses@.gmail.com> wrote in message
news:1142334055.274265.194010@.i40g2000cwc.googlegroups.com...
Hai all,
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...|||Hai..
it works... thanx...
Tom Moreau wrote:
> Try:
> use master
> go
> sp_helptext sp_databases
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Prince" <princevictor.moses@.gmail.com> wrote in message
> news:1142334055.274265.194010@.i40g2000cwc.googlegroups.com...
> Hai all,
> Is it possible to view the contents in built-in stored procedure
> like sp_databases?
> If possible, can anyone tell how to view it?
> Looking forward or the response...
> Thanx in advance...
Query
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...Try:
use master
go
sp_helptext sp_databases
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Prince" <princevictor.moses@.gmail.com> wrote in message
news:1142334055.274265.194010@.i40g2000cwc.googlegroups.com...
Hai all,
Is it possible to view the contents in built-in stored procedure
like sp_databases?
If possible, can anyone tell how to view it?
Looking forward or the response...
Thanx in advance...|||Hai..
it works... thanx...
Tom Moreau wrote:
> Try:
> use master
> go
> sp_helptext sp_databases
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> .
> "Prince" <princevictor.moses@.gmail.com> wrote in message
> news:1142334055.274265.194010@.i40g2000cwc.googlegroups.com...
> Hai all,
> Is it possible to view the contents in built-in stored procedure
> like sp_databases?
> If possible, can anyone tell how to view it?
> Looking forward or the response...
> Thanx in advance...
Monday, March 12, 2012
Quality of Displayed charts is poor
Then deploy, but when I view in the bouser(IE7) they look jaggered.
What am I doing wrong.
Thanks for any adviceOn Nov 7, 8:37 pm, gavin <ga...@.discussions.microsoft.com> wrote:
> I create some charts in VS and they look crisp.
> Then deploy, but when I view in the bouser(IE7) they look jaggered.
> What am I doing wrong.
> Thanks for any advice
This is just a thought, but you might want to shrink the chart control
in the report and see if maybe that improves the resolution, etc. Hope
this helps.
Regards,
Enrique Martinez
Sr. Software Consultant
Qouted String
I have a string user_name and it is saved in table with single
qoutes, i mean if you view the table there are single qoutes on both
sides of user_name like 'amir', it is saved with single qoutes. The
problem is how can i write sql query with = comparison, i'm
using
select * from sasuser.Followup where user_name= ' 'amir ' ';.
I need to use single qoutes for the query, coz variable is string but
how can i use single qoutes which are with the name itself.
Thanx.Khan (amir@.programmer.net) writes:
> I have a string user_name and it is saved in table with single
> qoutes, i mean if you view the table there are single qoutes on both
> sides of user_name like 'amir', it is saved with single qoutes. The
> problem is how can i write sql query with = comparison, i'm
> using
> select * from sasuser.Followup where user_name= ' 'amir ' ';.
> I need to use single qoutes for the query, coz variable is string but
> how can i use single qoutes which are with the name itself.
To include the string delimiter in a string literal you need to double
it:
SELECT * FROM sasuser.Followup WHERE user_name = '''amit''';
Note that when you work from client code, you should use parameterised
SQL commands, which makes this a non-issue..
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||thanx erland,, its fine now.
Saturday, February 25, 2012
Q: view over databases
How can I write a view that gets data from different database in the same
Database server?You can qualify object names with the database name:
CREATE VIEW dbo.MyView
AS
SELECT
t1.Col1,
t2.Col2
FROM Database1.dbo.Table1 t1
JOIN Database2.dbo.Table2 t2 ON
t1.Col3 = t2.Col4
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:92B7EB48-1A26-467F-97DB-8350669FDAF0@.microsoft.com...
> Hello,
> How can I write a view that gets data from different database in the same
> Database server?
>|||Qualify object names with the database name:
SELECT count(*)
FROM master.dbo.sysobjects as A
JOIN model.dbo.sysobjects as B
ON A.id = B.id
WHERE A.name <> B.name
Roy
On Wed, 22 Feb 2006 12:56:28 -0800, JIM.H.
<JIMH@.discussions.microsoft.com> wrote:
>Hello,
>How can I write a view that gets data from different database in the same
>Database server?
>|||Is this possible if the database on different server? I could not get it
working.
"Dan Guzman" wrote:
> You can qualify object names with the database name:
> CREATE VIEW dbo.MyView
> AS
> SELECT
> t1.Col1,
> t2.Col2
> FROM Database1.dbo.Table1 t1
> JOIN Database2.dbo.Table2 t2 ON
> t1.Col3 = t2.Col4
> GO
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
> news:92B7EB48-1A26-467F-97DB-8350669FDAF0@.microsoft.com...
> > Hello,
> > How can I write a view that gets data from different database in the same
> > Database server?
> >
> >
>
>|||You can use linked serves.
Look in BOL for linked servers
Regards
Amish Shah|||As Amish mentioned, you can create linked servers and then use 4-part names
to qualify objects: on different servers:
CREATE VIEW dbo.MyView
AS
SELECT
t1.Col1,
t2.Col2
FROM Database1.dbo.Table1 t1
JOIN OtherServer.Database2.dbo.Table2 t2 ON
t1.Col3 = t2.Col4
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:0D8CD62D-1258-49BE-B1C0-76F14235D931@.microsoft.com...
> Is this possible if the database on different server? I could not get it
> working.
> "Dan Guzman" wrote:
>> You can qualify object names with the database name:
>> CREATE VIEW dbo.MyView
>> AS
>> SELECT
>> t1.Col1,
>> t2.Col2
>> FROM Database1.dbo.Table1 t1
>> JOIN Database2.dbo.Table2 t2 ON
>> t1.Col3 = t2.Col4
>> GO
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
>> news:92B7EB48-1A26-467F-97DB-8350669FDAF0@.microsoft.com...
>> > Hello,
>> > How can I write a view that gets data from different database in the
>> > same
>> > Database server?
>> >
>> >
>>
Q: view over databases
How can I write a view that gets data from different database in the same
Database server?Qualify object names with the database name:
SELECT count(*)
FROM master.dbo.sysobjects as A
JOIN model.dbo.sysobjects as B
ON A.id = B.id
WHERE A.name <> B.name
Roy
On Wed, 22 Feb 2006 12:56:28 -0800, JIM.H.
<JIMH@.discussions.microsoft.com> wrote:
>Hello,
>How can I write a view that gets data from different database in the same
>Database server?
>
Q: view over databases
How can I write a view that gets data from different database in the same
Database server?
Qualify object names with the database name:
SELECT count(*)
FROM master.dbo.sysobjects as A
JOIN model.dbo.sysobjects as B
ON A.id = B.id
WHERE A.name <> B.name
Roy
On Wed, 22 Feb 2006 12:56:28 -0800, JIM.H.
<JIMH@.discussions.microsoft.com> wrote:
>Hello,
>How can I write a view that gets data from different database in the same
>Database server?
>