|
Home > Archive > MS SQL Server > November 2006 > query analyzer
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| 00KobeBrian 2006-11-09, 12:12 am |
| How do I open a query analyzer in SQL 2005? Thanks.
| |
| Josh Assing 2006-11-09, 12:12 am |
| in 2005, it's not a seperate tool; it's all part of the same manager
open up the manager
click on "New Query"
and that's it.
On Thu, 9 Nov 2006 13:33:21 +0800, "00KobeBrian" <a@b.com> wrote:
>How do I open a query analyzer in SQL 2005? Thanks.
>
--- AntiSpam/harvest ---
Remove X's to send email to me.
| |
| Hilary Cotter 2006-11-09, 5:16 am |
| you need to install the sql 2000 tools.
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"00KobeBrian" <a@b.com> wrote in message
news:eZArTC8AHHA.3928@TK2MSFTNGP03.phx.gbl...
> How do I open a query analyzer in SQL 2005? Thanks.
>
| |
| amatuer 2006-11-09, 7:13 pm |
| Hi, could someone tel me how do i execute a procedure that i created. I
am working with SQL Sever for the first time. Thanx.
Hilary Cotter wrote:[color=darkred
]
> you need to install the sql 2000 tools.
>
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
>
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
>
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
>
>
> "00KobeBrian" <a@b.com> wrote in message
> news:eZArTC8AHHA.3928@TK2MSFTNGP03.phx.gbl...
| |
| Hilary Cotter 2006-11-09, 7:13 pm |
| like this (assuming your proc is called ProcName)
ProcName
or exec ProcName
If you need to pass parameters to it, the proc will complain about each
parameter in turn.
Suppose you needed to pass an integer value you could do it like this
Procname 1
or
declare @intcol int
set @intcol=1
Procname @intcol
HTH
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"amatuer" <njoosub@gmail.com> wrote in message
news:1163079006.182230.55950@e3g2000cwe.googlegroups.com...
> Hi, could someone tel me how do i execute a procedure that i created. I
> am working with SQL Sever for the first time. Thanx.
>
>
> Hilary Cotter wrote:
>
| |
| amatuer 2006-11-10, 5:14 am |
| Thanx for the previous assistance provided in connection with the
execution of my procedure.
Another question. code:
SET @Yr = 1986
Set @Datum = '1/1/' & @Yr
I am experiencing a problem with the "Set @Datum " statement. Does
anyone know how would I use the cast function to convert this, " '1/1/'
& @Yr " to be put into my DateTime var,@Datum?
Thanx.
Hilary Cotter wrote:[color=darkred
]
> like this (assuming your proc is called ProcName)
>
> ProcName
>
> or exec ProcName
>
> If you need to pass parameters to it, the proc will complain about each
> parameter in turn.
>
> Suppose you needed to pass an integer value you could do it like this
>
> Procname 1
>
> or
>
> declare @intcol int
> set @intcol=1
> Procname @intcol
>
> HTH
>
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
>
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
>
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
>
>
> "amatuer" <njoosub@gmail.com> wrote in message
> news:1163079006.182230.55950@e3g2000cwe.googlegroups.com...
| |
| Tibor Karaszi 2006-11-10, 5:15 am |
| > I am experiencing a problem with the "Set @Datum " statement.
First, you concatenate using +, not & in TSQL. So this is the first to fix:
Set @Datum = '1/1/' + @Yr
However, since @Yr is an int, you need to CAST it to some string datatype:
Set @Datum = '1/1/' + CAST(@Yr AS char(4))
You now have something that *could* be interpreted as datetime. But you have an ambiguius format, I
don't know which part is the day and which is the month. So, either make sure you get it right using
SET DATEFORMAT, or use an unambiguous format before casting to datetime. See
http://www.karaszi.com/SQLServer/info_datetime.asp for details.
Assuming you have taken care of above, you can just cast that expression to datetime:
Set @Datum = CAST('1/1/' + CAST(@Yr AS char(4)) AS datetime)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
"amatuer" <njoosub@gmail.com> wrote in message
news:1163141097.553615.139390@m7g2000cwm.googlegroups.com...
> Thanx for the previous assistance provided in connection with the
> execution of my procedure.
> Another question. code:
>
> SET @Yr = 1986
> Set @Datum = '1/1/' & @Yr
>
> I am experiencing a problem with the "Set @Datum " statement. Does
> anyone know how would I use the cast function to convert this, " '1/1/'
> & @Yr " to be put into my DateTime var,@Datum?
>
> Thanx.
>
>
> Hilary Cotter wrote:
>
| |
| amatuer 2006-11-10, 5:15 am |
| Thanx Tobor. That worked. I have another problem. Below is the code:
CREATE PROCEDURE [dbo].[Wheat_10_3] AS
Declare @i int
Declare @x int
Declare @Yr int
Declare @Datum DateTime
Declare @Datum2 DateTime
Declare @Reenval int
Declare @Reenval2 int
Declare @name varchar(35)
Declare @TName varchar(35)
Declare @Count1 int
SELECT DISTINCT TOP 1 @TName = (NAAM) FROM R_Reenval With (Nolock)
Group By NAAM ORDER BY NAAM
SELECT @Count1 = Count (DISTINCT NAAM) FROM R_Reenval With (Nolock)
Group By NAAM ORDER BY NAAM
Set @Count1 = @Count1 + 1
Set @x = 1
While (@x < @Count1)
Begin
If @x > 1
SELECT DISTINCT TOP 1 @name = (NAAM) FROM R_Reenval With (Nolock)
WHERE (NAAM > @TName) ORDER BY NAAM
Else
Set @name = @TName
SET @Yr = 1986
While (@Yr < 2006)
Begin
Set @Datum = CAST('1/1/' + CAST(@Yr AS char(4)) AS datetime)
Set @Datum2 = @Datum + 9
Set @Reenval2 = 0
Set @i = 1
While (@i < 38)
Begin
Set @Reenval = 0
SELECT @Reenval = (SUM(Reenval_Silo)) FROM R_Reenval With (Nolock)
WHERE (NAAM = @name) AND (DATUM BETWEEN @Datum AND @Datum2)
GROUP BY NAAM
Set @Reenval2 = @Reenval2 + @Reenval
Insert Into R_Wheat_10_Dupl (Naam, BeginDatum, EindDatum, Reenval,
BeginJaar, BeginMaand, BeginDag, EindJaar, EindMaand, EindDag)
Values (@name, @Datum, @Datum2, @Reenval, Year(@Datum), Month(@Datum),
Day(@Datum), Year(@Datum2), Month(@Datum2), Day(@Datum2))
Set @Datum = @Datum +10
Set @Datum2 = @Datum2 +10
Set @i = @i + 1
End
Set @Yr = @Yr + 1
End
Set @TName = @name
Set @x = @x + 1
End
The above procedure should run through a list of names(outer loop),
then loop through years and then do some processing. The problem is the
outer loop. This is where the name is suposed to increment.
Unfortunately nothing happens. Can anyone by any chance see any problem
or have any suggestions for me? Much appreciated.
Tibor Karaszi wrote:[color=darkred
]
>
> First, you concatenate using +, not & in TSQL. So this is the first to fix:
>
> Set @Datum = '1/1/' + @Yr
>
>
> However, since @Yr is an int, you need to CAST it to some string datatype:
>
> Set @Datum = '1/1/' + CAST(@Yr AS char(4))
>
>
> You now have something that *could* be interpreted as datetime. But you have an ambiguius format, I
> don't know which part is the day and which is the month. So, either make sure you get it right using
> SET DATEFORMAT, or use an unambiguous format before casting to datetime. See
> http://www.karaszi.com/SQLServer/info_datetime.asp for details.
>
> Assuming you have taken care of above, you can just cast that expression to datetime:
>
> Set @Datum = CAST('1/1/' + CAST(@Yr AS char(4)) AS datetime)
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/
>
>
> "amatuer" <njoosub@gmail.com> wrote in message
> news:1163141097.553615.139390@m7g2000cwm.googlegroups.com...
|
|
|
|
|