Wednesday, March 7, 2012

GoDaddy / MySQL / SQL Server

I don't know if this is unique to GoDaddy: I found the program for working with a MySQL database very intuitive (to the point of compliments). Today I started work with ASP.NET and SQL, and when I went to work with SQL Server (on GoDaddy), it wasn't intuitive, and there was almost nothing on which to click. By chance might there be a tutorial that would help a person who needs to work with SQL Server on a provider like GoDaddy?

This may help...

http://forums.asp.net/thread/1456464.aspx

|||

I'm going through it, and I come to a point where I think it asks me to connect to the server (IP and PORT). I believe GoDaddy doesn't allow this (if someone reads this and I've misinterpreted it, please hollar--I know there is something that GoDaddy forbids regarding connected outside of their system).

If the above is true, does that make it so that the above process won't work (that's what I'm thinking right now.

However, thank you for the above link, because it gave me an idea. GoDaddy has it so that you can run queries. If I had a database with 250 entries and I didn't want to retype them all, I might be able to construct the database through the query box. Thanks! (going to test that out now.)

|||

The thread was started as a request by a newbie for help for someone who is on GoDaddy and they got to the SQL Server, and then they were stuck (what do I do next?) Over time I figured it out, and if you came to this post because you are "stuck", feel free to continue the thread with another question. I'm putting some basic things you want to know below:

Assuming that you've created a database under SQL Server and given it name and a password, and that you clicked on "Open Manager" in the row with the name of your database are now on a page with a name likehttps://mssqladmin.secureserver.net:

You see Quick Help with a bunch of words and icons (this doesn't help you though, those are not links, those are things you will see later).

On the left, you see Connection and Preferences, click Connection. Click the new link 'connection' the comes up underneath.

Put in your user name and password and click Connect.

There should be a new choice between Connection and Preferences on the left and it may have a name like whsql-v03.

Click that. You should then see Databases and Tools, and both will be helpful. Click Tools and then Query Analyser. This box is where you can type a query line that creates a table for your database:

CREATE TABLE mydictionary (word nvarchar(50), definition text)

and if it creates successfully, you will see "The command(s) completed successfully." appear underneath. You now have a table with two fields, word and definition.

Go back to the menu on the left and click Databases. something like DB_123456 comes up and click on that. Underneath you have Tables, Views, Stored Procedures. Click Tables. A list of tables comes up, many that you didn't make, but look for yours at the bottom. Don't click it just yet--instead, mouse over to all the icons on the right in the same row, and click the first one, content.

Look for the word Actions and then click that yellow star/asterisk. The next window gives you text boxes to put in your first entry. Fill them and click Insert.

At this point you have a database. It doesn't have things that are important, like a primary key with auto_increment, but the database will work for the purpose of confirming your first success.

|||

My advice to Godaddy users is to start with getting a simple page working that writes to one table in your new database. That will give you a web.config file with a working database connection and you can move on from there.

The web.config database connection seems a particular issue for newbies, I've put together a page with tips based around going live on GoDaddy with SQL Server, when you've got SQL Express on your local PC.

http://www.salmontraining.com/SqlExpressZone/Articles/why_the_development_config_file_wont_work_on_live_shared_hosting_with_sql_server.aspx

God Only Knows Why???

CREATE TABLE [__1] (
[n] [int] IDENTITY (1, 1) NOT NULL ,
[a] [decimal](16, 5) NULL
) ON [PRIMARY]
GO

INSERT INTO __1
(a)
VALUES (1.22115)

select * from __1

------------
RESULTS FROM Query Analyzer
------------

(1 row(s) affected)

n a
---- ------
1.00 1.22

(1 row(s) affected)

When I go to the Enterprise Manager and see the data, it appears as

n a
---- ------
1.00 1.22115

I am soooo confused!! Highly appreciating your comments...try inserting 1.22000|||Originally posted by RaedT
CREATE TABLE [__1] (
[n] [int] IDENTITY (1, 1) NOT NULL ,
[a] [decimal](16, 5) NULL
) ON [PRIMARY]
GO

INSERT INTO __1
(a)
VALUES (1.22115)

select * from __1

------------
RESULTS FROM Query Analyzer
------------

(1 row(s) affected)

n a
---- ------
1.00 1.22

(1 row(s) affected)

When I go to the Enterprise Manager and see the data, it appears as

n a
---- ------
1.00 1.22115

I am soooo confused!! Highly appreciating your comments...
it gives right results for me.|||Karolyn:
After iserting 1.22000, nothing changed!
the output is still rounded to 1.22

harshal_in:
Notice the output from the Query Analyzer. The inserted value 1.22115 was rounded to 1.22, I need the Query Analyzer to give me what really exists in the table 1.22115, not 1.22!!

Originally posted by harshal_in
it gives right results for me.|||sorry I've mis-read your pb

it's the same pb as last week !

you must have a property or option in your QA that
rounds up your data

or maybe you don't see it totally... (?)

try

Select '-' + convert(varchar(50),a) + '-' From Table|||CREATE TABLE [__1] (
[n] [int] IDENTITY (1, 1) NOT NULL ,
[a] [decimal](16, 5) NULL
) ON [PRIMARY]
GO

INSERT INTO __1
(a)
VALUES (1.22115)

select 'Value = '+convert(varchar,a) from __1

What does this return ?|||Output:
------------
Value = 1.22115

? What does this mean?

Originally posted by Enigma

CREATE TABLE [__1] (
[n] [int] IDENTITY (1, 1) NOT NULL ,
[a] [decimal](16, 5) NULL
) ON [PRIMARY]
GO

INSERT INTO __1
(a)
VALUES (1.22115)

select 'Value = '+convert(varchar,a) from __1

What does this return ?|||that you don't see the all the numbers of your result

the column in the QA is too narrow
maybe there's an option to adapt the witdht of a column|||Just curious .. whats the version of sql query analyzer are you using ...
I found no option in QA that does rounding off :confused:|||Go see TOOLS-OPTIONS in the QA

in the Result tab there's a number of caracters

(maybe someone that doen't like you set it to 4)|||QA Version: 8.00.760
Max. Characters per column: 256

Note, even the int type value (1) appears as 1.00

Originally posted by Karolyn
Go see TOOLS-OPTIONS in the QA

in the Result tab there's a number of caracters

(maybe someone that doen't like you set it to 4)|||At least you've got the good result in the table...
(Being optimistic)

Check all the options in your databases and in QA|||how are you starting up your query analyzer ?

By clicking on an icon ? The only thing i can think of is that you might be starting up your qa with some configuration options

Check your shortcut properties ... the error might lie there|||I am starting my QA from the EM.

TOOLS=> SQL QA

Originally posted by Enigma
how are you starting up your query analyzer ?

By clicking on an icon ? The only thing i can think of is that you might be starting up your qa with some configuration options

Check your shortcut properties ... the error might lie there|||did you find the round-up-property ??|||I can go ahead of my work, I converted the decimal numbers to varchar, so I can get the results with 5 decimal places, but I am so frustrated and need to know why? I am so curious to know what the problem is.

Originally posted by Karolyn
did you find the round-up-property ??|||If you see BlindMan or Breitt Kaiser online
Ask them !!!|||I get

n a
---- ------
1 1.22115

(1 row(s) affected)

No way an int is decimal(5,2)

I checked the options for the result set and don't see anything...

What collation are you using...(doubt that that's it either)

I don't buy that a column defined like you posted will ever display an identity that way...|||Grasping at straws here, but Karolyn obligates me to respond...

What is your "Use regional settings when outputting currency, number, dates, and times" setting in QA options? (It's in the connections tab.)

If it is on, try setting it to off.

From Books Online:

"Use regional settings when outputting currency, number, dates, and times.
Turning this setting to ON causes the ODBC driver to respect the local client setting when converting numeric, date, time, and currency values to character strings. The conversion is from SQL Server native data types to character strings only. When the setting is OFF, the driver does not convert numeric, date, time, and currency data to character string data using the client locale setting. The conversion setting is only applicable to output conversion and is only visible when currency, numeric, date, or time values are converted to character strings (which is always the case with Query Analyzer). The default for this setting is OFF. "|||It's in

Tools>Options

Menu

Never even thought to look their...

if that's the case...

Why do people mess with ANY settings...I leave'em alone...

God, If I had to remeber what I set...I'd go crazy....

Certainly ups the Mriacle ante.....

as in "God only knows why"|||Blindman .. i believe you have hit the nail on the head ...|||If I did, it's only because it was the last thing that could be suggested!|||I never would have found that in QA. Good job, Blindman.|||Blindman, you deserve millions kisses. You are a superman.
Brett Kaiser: I did not get all what you posted, but I can smell the aggressive way in your reply. Sorry for INCONVENIENCE and thanks anyway.
Thank you all for help, now I can sleep well.|||Originally posted by RaedT
Blindman, you deserve millions kisses. You are a superman.
Brett Kaiser: I did not get all what you posted, but I can smell the aggressive way in your reply. Sorry for INCONVENIENCE and thanks anyway.
Thank you all for help, now I can sleep well.

Whatever...It was a stretch for us to figure out what happend...know why?

Because we never touch that stuff...

But it seems like someone did...why?

My point was exactly that...don't mess with the settings...|||still that agressive tone in your writing...|||I can't believe I got that one. Like I said, you guys had already eliminated everything else.|||Brett Kaiser: Man take a chill pill,
That option is set to ON by default after installation.

Originally posted by Brett Kaiser
Whatever...It was a stretch for us to figure out what happend...know why?

Because we never touch that stuff...

But it seems like someone did...why?

My point was exactly that...don't mess with the settings...|||"That option is set to ON by default after installation."

Really? I don't recall seeing that set to ON before. And I don't recall every changing it.|||RaedT
try and see if there's someone in your entourage
that doesn't like you
and put that option to ON|||That's because it's not....|||If setting that value to ON is somebody's idea of being malicious, they aren't very imaginative. It was probably set by accident, or there was a "reason for it at the time".

GoalSeek in SQL Server?

Has anyone create a GoalS function similar to that of Excel? I've
been researching this and trying to script one out myself without much
sucess. If someone could tell me that its impossible, that would be
helpful too. TIA.This is not really what SQL is used for.|||You may be able to do it in MDX using multiple-pass calculations to iterate
to the required result:
http://msdn.microsoft.com/library/d...
anced_6jn7.asp
In pure SQL you could perhaps do it without iteration if the range of
possible values is small enough:
SELECT TOP 1 N1.num, N2.num
FROM some_numbers AS N1, some_numbers AS N2
WHERE (N1.num + (N2.num/2) - 123) = 12345
ORDER BY N1.num, N2.num
David Portas
SQL Server MVP
--|||I have used SQL to solve number puzzles, just for fun (eh!?). Try the
following script.
-- Easy example, all combinations of the numbers 1-9 which add up to 11
DECLARE @.control TABLE ( control_no TINYINT PRIMARY KEY, control_str AS CAST
(control_no AS CHAR(1) ) )
DECLARE @.i INT
SET NOCOUNT ON
SET @.i = 0
-- Add control numbers to temp table
WHILE @.i Between 0 And 9
BEGIN
INSERT @.control VALUES( @.i )
SET @.i = @.i + 1
END
SET NOCOUNT OFF
-- List all combinations which add up to 11
SELECT a.control_no, b.control_no, a.control_no + b.control_no
FROM @.control a, @.control b
WHERE a.control_no + b.control_no = 11
-- Harder example; MENSA-type substitution puzzle
-- Mensa's Number Puzzles for Math Geniuses by Harold Gale has this puzzle:
--
-- Number Puzzle 58
-- Place six three digit numbers of 100 plus at the end of 685
-- so that six numbers of six digits are produced [like 685123].
-- When each number is divided by 111 six whole numbers can be found.
SELECT
a.control_str,
b.control_str,
c.control_str,
a.control_str + b.control_str + c.control_str AS result,
'685' + a.control_str + b.control_str + c.control_str AS result2,
CAST( '685' + a.control_str + b.control_str + c.control_str AS DECIMAL ) /
111 AS result2
FROM @.control a, @.control b, @.control c
WHERE a.control_str + b.control_str + c.control_str > 100
AND ( CAST( '685' + a.control_str + b.control_str + c.control_str AS
DECIMAL ) / 111 ) =
CAST ( CAST( '685' + a.control_str + b.control_str + c.control_str AS
DECIMAL ) / 111 AS INT )
ORDER BY 1
-- This puzzle is similar to ones like this:
-- How many three digit numbers are divisible by 17?
-- Well, the first one is greater than 100. 100/17=5.88235. . . So the first
is 6x17=102. We don't need to list these three digit numbers. The last one i
s
less than 1000. 1000/17=58.8235. . . So our three digit numbers are 6x17,
7x17, 8x17, . . ., 58x17. There are 53 such numbers.
SELECT
a.control_str,
b.control_str,
c.control_str,
a.control_str + b.control_str + c.control_str AS result,
CAST( a.control_str + b.control_str + c.control_str AS DECIMAL ) / 17 AS
result2
FROM @.control a, @.control b, @.control c
WHERE a.control_str + b.control_str + c.control_str > 100
AND ( CAST( a.control_str + b.control_str + c.control_str AS DECIMAL ) /
17 ) =
CAST ( CAST( a.control_str + b.control_str + c.control_str AS DECIMAL ) /
17 AS INT )
ORDER BY 1
-- etc
Obviously the code above is quick and dirty, but you see where I'm going.
If not, look up 'Cartesian products'. Don't go using it in production
environment!
Let me know hot you get on.
Damien
"carmaboy@.gmail.com" wrote:

> Has anyone create a GoalS function similar to that of Excel? I've
> been researching this and trying to script one out myself without much
> sucess. If someone could tell me that its impossible, that would be
> helpful too. TIA.
>|||Did you notice that you wind up generating all possible combinations|||Yes, I'm using the cartesian product to get the answers to the puzzles. Is
that what you mean? Presumably there are other ways to do this, but this wa
s
just a demo, and hey it works!
Damien
"--CELKO--" wrote:

> Did you notice that you wind up generating all possible combinations
>|||Perhaps Joe's point was that declarative SQL solutions generally will
produce the total set of results, effort that is highly redundant if
all solutions are equal. What you probably wanted was just the fastest
single solution. That's why SQL is likely a heavily inefficient
solution - ok for solving recreational problems but in a commercial
environment you'll probably be better off with a procedural language or
a math/stats package.
David Portas
SQL Server MVP
--|||>> Perhaps Joe's point was that declarative SQL solutions generally will pro
duce the total set of results, <<
In fact, I just a did a short piece for DBAzine with a simple bin
packing problem (one bin, n-items) to demonstrate how the answer space
keeps doubling.

Go To Url through Sql

Is there a way to open a webpage through SQL?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200703/1Hello,
No, Why do you want to do this..
Thanks
Hari
"Tazar via droptable.com" <u32345@.uwe> wrote in message
news:6ff4f7c09af9e@.uwe...
> Is there a way to open a webpage through SQL?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200703/1
>

Go To Url through Sql

Is there a way to open a webpage through SQL?
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200703/1Hello,
No, Why do you want to do this..
Thanks
Hari
"Tazar via SQLMonster.com" <u32345@.uwe> wrote in message
news:6ff4f7c09af9e@.uwe...
> Is there a way to open a webpage through SQL?
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200703/1
>

Go To Url through Sql

Is there a way to open a webpage through SQL?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums.aspx/sql-server/200703/1
Hello,
No, Why do you want to do this..
Thanks
Hari
"Tazar via droptable.com" <u32345@.uwe> wrote in message
news:6ff4f7c09af9e@.uwe...
> Is there a way to open a webpage through SQL?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums.aspx/sql-server/200703/1
>

Go to the last record

How can I go to the last record of database? I've been having problems after creating a new record, and trying to display it, but I don't know what primary ID it's given, so I dont know how to go the last record. Thanks for the help.

Quote:

Originally Posted by LuiePL

How can I go to the last record of database? I've been having problems after creating a new record, and trying to display it, but I don't know what primary ID it's given, so I dont know how to go the last record. Thanks for the help.


if you want to find the last record in a table (with PK = xx) you can to try with:

select * from tabv where xx = (select max(xx) from tab)|||Many thanks!!!!|||Hi,
select top 1 * from tablename order by column name desc