Showing posts with label online. Show all posts
Showing posts with label online. Show all posts

Sunday, March 25, 2012

A couple of questions

Well, I had a questions, but I figured I'd include all of the things I've been trying to figure out.

I remember reading in books online about transformnig the data returned by a SQL query. For example, the database has a boolean 1 or 0, but I want to return a Yes / No or True / False. You could even doa number mapping for example, 1 becomes "one", 2 becomes "two" etc. Can anyone point me in the right direction?

Is there a way to check a data field for a specific format? SELECT IDNumber from table WHERE IDNumber is not 6 numberic digits. (IDNumber is nvarchar with a length of 50 and stores IDNUmbers that also contain letters and special characters)

Query returns 123456789, 12345678, 2-0152, A5487, but not 123456 or 101254, etc.

How do I insert several lines if I have the data as text? I can insert multiple lines from another table, but how do I insert multiple lines if I want to type in the data?

How do I insert the same line into several SQL database on different computers using query analyzer? I basically have to enter a line for each user into the user table. I can do it with osql, but I don't know haw to change the server in query analyzer. With query analyzer I can create a script and just substitute the variables defined at the beginning.

Thanks,

Cory

1. To 'transform' data, use the CASE structure.

Code Snippet


SELECT Gender = CASE Sex

WHEN 1 THEN 'M'

WHEN 0 THEN 'F'

END

FROM MyTable.

2. To check for specific format, i.e., 6 character number, something like this 'should' work for you (it's not perfect, but I think it may give you what you desire):


Code Snippet


SET NOCOUNT ON


DECLARE @.MyTable table
( IDNumber varchar(50) )


INSERT INTO @.MyTable VALUES ( '123456789' )
INSERT INTO @.MyTable VALUES ( '12345678' )
INSERT INTO @.MyTable VALUES ( '2-0152' )
INSERT INTO @.MyTable VALUES ( 'A5487' )
INSERT INTO @.MyTable VALUES ( 'A54871' )
INSERT INTO @.MyTable VALUES ( '123456' )
INSERT INTO @.MyTable VALUES ( '101254' )


SELECT IDNumber
FROM @.MyTable
WHERE ( len( IDNumber ) <> 6
OR isnumeric( IDNumber ) = 0
)

IDNumber
--
123456789
12345678
2-0152
A5487
A54871

3.

How do I insert several lines if I have the data as text?

I don't understand what you want to do here, please give more information.

4. Click on [File], [Connect], to connect to a different server. Open your script file, or cut/paste from the previous connection window.

(OR)

Set the additional Servers up as 'linked servers'. Refer to Books Online, Topic: 'Linked Server', sp_addlinkedserver.

Then you can use four object part naming to designate the server.

|||

Hi Arnie,

May be we can use following statement for point number 2.

select

*

from

@.MyTable

where

IDNumber notlike'[0-9][0-9][0-9][0-9][0-9][0-9]'

AMB

|||

Thank you for your quick reply.

For #3. In your example you used 7 insert statements to insert the rows into the table. Is there a way to insert them using one statement?

For #4. Is there a way to do it without adding linked servers? In osql, I type

osql -S 192.168.1.123 -E -d databasename -Q "INSERT INTO USERS(username, password) VALUES ("name", "pw")

osql -S 192.168.1.124 -E -d databasename -Q "INSERT INTO USERS(username, password) VALUES ("name", "pw")

osql -S 192.168.1.125 -E -d databasename -Q "INSERT INTO USERS(username, password) VALUES ("name", "pw")

osql -S 192.168.1.126 -E -d databasename -Q "INSERT INTO USERS(username, password) VALUES ("name", "pw")

Is there a way to do it in query analyzer without linked servers.

Thanks,

Cory

Sunday, March 11, 2012

70-431 SQL Server 2005 exam

hi there,

i am planning to take the exam 70431 for sql server 2005 ...does any one have a good exam and course material either online or it will be great if it could be emailed to me.

Thanks in advance

You can google Sql Server 2005 exam materials from website and will get a lot.Besides this,SQL Server 2005 online help is a good one for you.

|||

i tried already !!

i could not see FREE material there either exam or course material ... if you get luck in google :) ...please send me the links

Thanks for the reply

|||

If you are not in a hurry the book used by SQL Server people is by Robert Vierra but if you are take the second link and fill it in as the third link is from MSDN and you have a study guide or just print it out with the developer edition or Enterprise installed run searches in the BOL. And remember to understand the recursive trigger because Microsoft is known to give you four almost identical triggers with nothing more than space missing. And the index structure have changed know the whole thing because indexes are vendors creations all improvements are very important, when you are through with the material get Transcenders exams because the material is not the exam. If you know how to take the exam you are almost there. Hope this helps.

http://www.amazon.com/gp/product/0764584340/002-6732392-4240017?v=glance&n=283155

http://www.microsoft.com/learning/exams/70-431.asp

http://www.codeclinic.com/70-229skills.htm

Tuesday, March 6, 2012

64-bit MSDE?

I've seen references in Microsoft online material to a 64-bit
edition of MSDE - the description of Windows XP 64-bit
Edition Version 2003 refers to it, for example. However,
I haven't been able to find any more information about the
existence, if any, and availability of 64-bit MSDE. I'm
specifically intererested in determining whether it's
available for the server operating system editions .
Can anyone help?
Thanks,
Peter Hornby
Unisys Corporation
Mission Viejo
hi Peter,
"Pete Hornby" <peter.hornby@.unisys.com> ha scritto nel messaggio
news:umltR66KEHA.644@.tk2msftngp13.phx.gbl...
> I've seen references in Microsoft online material to a 64-bit
> edition of MSDE - the description of Windows XP 64-bit
> Edition Version 2003 refers to it, for example. However,
> I haven't been able to find any more information about the
> existence, if any, and availability of 64-bit MSDE. I'm
> specifically intererested in determining whether it's
> available for the server operating system editions .
AFAIK, only the Enterprise Edition is available in the 64bit flavour..
http://www.microsoft.com/sql/evaluat...ew/default.asp and
http://www.microsoft.com/sql/64bit/default.asp
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.7.0 - DbaMgr ver 0.53.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:c6jga9$cocpm$1@.ID-207518.news.uni-berlin.de...
> hi Peter,
> "Pete Hornby" <peter.hornby@.unisys.com> ha scritto nel messaggio
> news:umltR66KEHA.644@.tk2msftngp13.phx.gbl...
> AFAIK, only the Enterprise Edition is available in the 64bit flavour..
> http://www.microsoft.com/sql/evaluat...ew/default.asp and
> http://www.microsoft.com/sql/64bit/default.asp
Andrea,
Many thanks for your quick response. I accept what you say, but I
remain confused by the statement - admittedly a year old - in
http://www.microsoft.com/windowsxp/6...uation/faq.asp
where the answer to "What's New In Windows XP 64-Bit Edition
Version 2003" includes the line "Microsoft SQL Server Desktop
Engine (MSDE)".
Peter
|||hi Peter,
"Pete Hornby" <peter.hornby@.unisys.com> ha scritto nel messaggio
news:c6jll6$17ca$1@.si05.rsvl.unisys.com...
> Many thanks for your quick response. I accept what you say, but I
> remain confused by the statement - admittedly a year old - in
> http://www.microsoft.com/windowsxp/6...uation/faq.asp
> where the answer to "What's New In Windows XP 64-Bit Edition
> Version 2003" includes the line "Microsoft SQL Server Desktop
> Engine (MSDE)".
as IIS 6.0, I think that MSDE 2000 will be (or is) provided in the 32bit
flavour =:-)
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.7.0 - DbaMgr ver 0.53.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Thursday, February 16, 2012

5 Database Queries to go with an online purchasing system :-)

Hi Guys,

I'm having trouble thinking of ideas for queries that would go with an online purchasing system. The queries must be partially complex (i.e. not just a simple insert query :p).

I can easily write the queries myself but i just need a little help thinking of useful queries.

A query for an 'Invoice' for example is a perfect idea as it implements table joins etc.

Possible other queries are:
Find all customers that have spent a total of more than X amount
Find all delivery address's that X customer has sent items to
Track an order to see if items have been sent yet or not.
etc...

If anyone else can think of a few other ideas i'd be very grateful :-)

thx for reading :-)

--Philkillsonline purchasing sytem? or homework assignment? ;)

total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)|||easiest technique...
open a copy of Access, create yuour tables
create the realtionships
open up the query designer
add the required constraints...
run the query, prove it works
open up the query in SQL mode, copy and paste the SQL to your homework assignment paper
...jobsagoodun

... requires minimum thought and creativity, and absolutely no proof that you have understood the concepts behid joins, where clauses etc...|||online purchasing sytem? or homework assignment? ;)

total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)

Some nice ideas there thx ^^

easiest technique...
open a copy of Access, create yuour tables
create the realtionships
open up the query designer
add the required constraints...
run the query, prove it works
open up the query in SQL mode, copy and paste the SQL to your homework assignment paper
...jobsagoodun

... requires minimum thought and creativity, and absolutely no proof that you have understood the concepts behid joins, where clauses etc...

and lol...

a nice way to cheat i suppose... but i do actually understand joins etc ;p|||total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)
Variations on these:
- Total sales for all foregoing months
- Top ten most popular items
- Most popular category per client (useful for better direct advertising ;-)
- Top ten clients in terms of the amount spent
- Same question, but now in 12 columns, for each of the last 12 months|||- Customer's year to date sales (purchases) compared with last year's year to date sales (purchases).
:shocked: