Friday, March 30, 2012
Need to convert a given date to fiscal year
start from 1-Apr to 31-Mar each year and I need the fiscal year in the
format like 2005-06 etc. ThanksOn Thu, 11 May 2006 15:02:15 -0700, Paul wrote:
>In a Sql query I need to convert a given date to fiscal year. Fiscal year
>start from 1-Apr to 31-Mar each year and I need the fiscal year in the
>format like 2005-06 etc. Thanks
>
Hi Paul,
http://www.aspfaq.com/show.asp?id=2519
Hugo Kornelis, SQL Server MVP
Need to convert a date and time to a different format
When I run getdate(), I get, for example:
August 9 2004 5:17 P.M.
I want to turn the date portion into:
8/9/2004 format and update one column with it
I want to turn 5:17 P.M. into:
hhmmss and update another column with it.
I've been playing around with datepart, with substr, with you name it,
and I'm stumped.
Any code samples, other help most appreciated.
Thanks,
Google Jenny
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Hi
If you column is a datetime data type then there will always be a time
portion. Not specifying the time when you update the field will default it
to 00:00:00. To return a string representation of the date and time you can
use the CONVERT function to specify a format. See the topic "CAST and
CONVERT" in books online. Use the REPLACE function if you want to strip out
the colons.
DECLARE @.myDate datetime
SET @.myDate = '20040809 17:17'
SELECT @.myDate, CONVERT(char(10),@.myDate,101) + ' ' +
REPLACE(CONVERT(char(8),@.myDate,108),':','')
John
"Google Jenny" <michiamo@.yahoo.com> wrote in message
news:41423954$0$26152$c397aba@.news.newsgroups.ws.. .
> Precisely, here's what I need:
> When I run getdate(), I get, for example:
> August 9 2004 5:17 P.M.
> I want to turn the date portion into:
> 8/9/2004 format and update one column with it
>
> I want to turn 5:17 P.M. into:
> hhmmss and update another column with it.
>
> I've been playing around with datepart, with substr, with you name it,
> and I'm stumped.
> Any code samples, other help most appreciated.
> Thanks,
> Google Jenny
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!sql
Need to Connect to SQL Server via TCP - Resources?
protocol used to communicate to the Server via port 1433.
Any info would be helpful...
Thank you,
Scott<-Hi
SQL Server uses TDS (Tabular Data Stream). The on-the-wire protocol details
are available to 3rd party vendors, but there is no public documentation of
it.
Regards
Michel Epprecht
This posting is provided "AS IS" with no warranties, and confers no rights.
"Scott Townsend" <scott-i@..-N0-SPAMplease.enm.com> wrote in message
news:O1Ha12ROHHA.3668@.TK2MSFTNGP02.phx.gbl...
>I need to create my own SQL Client and am looking for resources on the
>protocol used to communicate to the Server via port 1433.
> Any info would be helpful...
> Thank you,
> Scott<-
>
Need to connect to SQL Server on other side of firewall, listening to a different port
I want to communicate to SQL Server through my client. Server is listening
via port 16433 instead of defualt 1433.
And this particular server is on the other side of the firewall and it is in
a workgroup. Client Server is in a domain.
I have tried specifying ServerName,PortNo. but it does not work.
Any one know some other way to communicate to this server. Please help.
Thanks
PushkarCan you show us a connection string?
"Pushkar" <tiwaripushkar@.yahoo.co.in> wrote in message
news:OS%23hNh2hFHA.3288@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I want to communicate to SQL Server through my client. Server is listening
> via port 16433 instead of defualt 1433.
> And this particular server is on the other side of the firewall and it is
in
> a workgroup. Client Server is in a domain.
> I have tried specifying ServerName,PortNo. but it does not work.
> Any one know some other way to communicate to this server. Please help.
> Thanks
> Pushkar
>|||Hi,
I am trying to connect through enterprise browser. And while registering for
the server I am giving server name as
"MyServer,16433"
where 16433 is port on which SQL Server is listening.
Thanks
Pushkar
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%233IYy92hFHA.2484@.TK2MSFTNGP15.phx.gbl...
> Can you show us a connection string?
> "Pushkar" <tiwaripushkar@.yahoo.co.in> wrote in message
> news:OS%23hNh2hFHA.3288@.TK2MSFTNGP09.phx.gbl...
> in
>|||"Pushkar" <tiwaripushkar@.yahoo.co.in> wrote in message
news:u2to5K3hFHA.1412@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I am trying to connect through enterprise browser. And while registering
> for the server I am giving server name as
> "MyServer,16433"
> where 16433 is port on which SQL Server is listening.
Does the name MyServer resolve on your system? Names must be resolved to IP
addresses (or MAC addresses) using some mechanism, NetBIOS broadcasts, DNS,
WINS -- something. Try pinging it. If you have no reason to believe the
name will resolve, you have no expectation of connectivity with SQL Server.
If you have no mechanism for resolving the name, use the IP address of the
SQL box in place of the name.
Also, are you on the inside of the firewall, or the outside? If you are on
the outside, that port must have been opened by the admin of the firewall.
If you are on the inside, the firewall is *most*likely* not a significant
factor (though that is not exclusively true, a capable firewall can be
configured to block traffic in either direction, it just isn't usually done
that way.)
-Mark
> Thanks
> Pushkar
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%233IYy92hFHA.2484@.TK2MSFTNGP15.phx.gbl...
>|||Pushkar
Go to the Client Network Utility and create an alias to SQL Server that is
listening 16433 port
Make sure that TCPIP is at begining of the list.
"Pushkar" <tiwaripushkar@.yahoo.co.in> wrote in message
news:u2to5K3hFHA.1412@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I am trying to connect through enterprise browser. And while registering
for
> the server I am giving server name as
> "MyServer,16433"
> where 16433 is port on which SQL Server is listening.
> Thanks
> Pushkar
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%233IYy92hFHA.2484@.TK2MSFTNGP15.phx.gbl...
is[vbcol=seagreen]
>|||Hi,
Thanks it works by creating alias.
Thanks
Pushkar
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OfLT1d3hFHA.1148@.TK2MSFTNGP12.phx.gbl...
> Pushkar
> Go to the Client Network Utility and create an alias to SQL Server that is
> listening 16433 port
> Make sure that TCPIP is at begining of the list.
>
> "Pushkar" <tiwaripushkar@.yahoo.co.in> wrote in message
> news:u2to5K3hFHA.1412@.TK2MSFTNGP09.phx.gbl...
> for
> is
>
Need to compare data in SQL to Oracle / import changes
So we need an agent that will
1) Compare data in both databases (From disparate tables)
2) Import only that which is changes or new.
I am new to SQL server administration and am looking for a best practice method that we can be run on a weekly basis.
I am open to using third party software solutions, but would prefer a native MS SQL 2000 solution.
Can someone point me in the right direction?
Thanks.How much data are we talking about?
Check out this
http://weblogs.sqlteam.com/brettk/archive/2004/04/23/1281.aspx
Need to combine string data from multiple columns into one column
When quering a table with given criteria, For ex:
select notes, jobid, caller from contact where status in (6) and jobid = 173
I am getting this:
This job will be posted to Monster for 2 weeks. 173 906
Waiting for full budget approval 173 906
TUrns out we're uppin 173 906
What should I do so that these three columns for the same jobid from the same caller appears in only one column, either separated by a comma or semicolon?
Please HELP!!!!!
Concatenating row values in Transact-SQL
http://www.projectdmx.com/tsql/rowconcatenate.aspx
AMB
|||You can concantenate the results, but you need to ensure that you have converted all the different data types to varchar. E.g.
Code Snippet
SELECT notes + ' , ' + CAST(jobid as varchar(100)) + ' , ' + CAST(caller as varchar(100)) FROM contact WHERE status in (6) and jobid = 173
I assumed that jobid and caller are int fields.
HTH
Ray
|||Here it is (if you use SQL Server 2005),
Code Snippet
select distinct
(
select
notes + ';' as [text()]
from
contact sub
where
sub.caller=main.caller
and sub.jobid=main.jobid
for xml path('')
) as notes,
jobid,
caller
from
contact main
where
status in (6)
and jobid = 173
|||Thanks for the response sekaran. I should have mentioned it before, I am using sql server 2000 using tsql language. Also the notes columns is of text type which I will cast as nvarchar(3500). I am having problems running you code. What am i doing wrong? can u help?
Need to collect serverinfo
Servers and collect some ServerInfo such as Windows Version/Service Pack,
SQL Version/Service Pack,CPU ( Number and Type) ,Server Model(HP,Dell),
Memory , Disk Space, NIC settingg(IP address)etc and stick it into a table
for reporting. The more info the better..
Hello,
The below extended proc will give info regarding OS, SQL Server, Memory and
CPU.
Master..xp_msver
Thanks
Hari
"Hassan" <Hassan@.hotmail.com> wrote in message
news:%23cHiWIOQHHA.3872@.TK2MSFTNGP06.phx.gbl...
> Is there a way that I can run some batch file or query to go out to all
> SQL Servers and collect some ServerInfo such as Windows Version/Service
> Pack, SQL Version/Service Pack,CPU ( Number and Type) ,Server
> Model(HP,Dell), Memory , Disk Space, NIC settingg(IP address)etc and stick
> it into a table for reporting. The more info the better..
>
sql