Showing posts with label written. Show all posts
Showing posts with label written. Show all posts

Wednesday, March 28, 2012

Help for INTRO function

Hello.
I need to create a new table from a query result, then I've written this SQL
command:
"SELECT Name, Number FROM Friends INTRO Result"
BUT
SQL give me an error!!
Please Help Me
Bye
CrisI assume you mean INTO not INTRO
SELECT Name, Number INTO result FROM Friends
http://sqlservercode.blogspot.com/|||Cristian wrote:
> Hello.
> I need to create a new table from a query result, then I've written this S
QL
> command:
> "SELECT Name, Number FROM Friends INTRO Result"
> BUT
> SQL give me an error!!
> Please Help Me
> Bye
> Cris
It's INTO not INTRO.
However, the resulting table won't have any keys or constraints.
Although SELECT INTO is handy as a quick and dirty way to create
tables, it may be better to do something like:
CREATE TABLE Result (name VARCHAR(50) NOT NULL, number INTEGER NOT
NULL, PRIMARY KEY ...)
INSERT INTO Result (name, number)
SELECT name, number
FROM Friends ;
David Portas
SQL Server MVP
--|||Also,
If you need an autonumber in the destination table and need the data ordered
you must create the table first.
Good code:-
Create table myTable ( id int identity(1,1) not null, name varchar(50) not
null )
INSERT INTO myTable ( name ) SELECT name FROM friends ORDER BY name
if you use "select identity(int,1,1) AS id , name into MyTable from ..."
the order is not guaranteed and so it is advised against.
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1134382059.521678.242420@.g44g2000cwa.googlegroups.com...
> Cristian wrote:
SQL
> It's INTO not INTRO.
> However, the resulting table won't have any keys or constraints.
> Although SELECT INTO is handy as a quick and dirty way to create
> tables, it may be better to do something like:
> CREATE TABLE Result (name VARCHAR(50) NOT NULL, number INTEGER NOT
> NULL, PRIMARY KEY ...)
> INSERT INTO Result (name, number)
> SELECT name, number
> FROM Friends ;
> --
> David Portas
> SQL Server MVP
> --
>

Monday, March 26, 2012

Help find better option:Views from table in various Db Viz local d

I am having performance issues Timeout, blocking , long running stored
procedures etc.
Application is written in C sharp and uses database sql2000 sp3.
I have about 25 databases, view is used that joins tables from all db with
left outer join and multiple conditions in where clause.
Online updates are taking place which again goes back to that particular
table in spec. db. Triggers are used at few places to update the view. Every
where stored procedures are used extensively instead of t-sql. In sp at
places table variables are used to minimise locks.
In the initial phase only with each database having few thousand records
user start getting timeout ,slow response & blocking complaints.
Should I copy the view to have local copy of data and have job that run
every min or 2 to update local table . In that too I am not clear that how
useful it will be to keep local copy bcz. it will grow huge in size with
growth in all db.
Very complex thing I see is continuous updates back and forth , which may
keep local copy block for most of the time or else user wan't have latest
data available in their app.
Any one who has worked with similar situation can be lot more useful,
I will highly appreciate any suggestions or discussions from sql experts.
Thanks,Views can be good or bad. If you follow the rules for creating partitioned
views then only the needed table(s) will be scanned. Else, every table in a
view will be scanned which would introduce more unnecessary locks.
http://msdn.microsoft.com/library/e...des_06_9mlv.asp
-oj
"Sameer Raval" <Sameer Raval @.discussions.microsoft.com> wrote in message
news:DB036029-CA4E-463D-B475-19BCE875ACA7@.microsoft.com...
>I am having performance issues Timeout, blocking , long running stored
> procedures etc.
> Application is written in C sharp and uses database sql2000 sp3.
> I have about 25 databases, view is used that joins tables from all db with
> left outer join and multiple conditions in where clause.
> Online updates are taking place which again goes back to that particular
> table in spec. db. Triggers are used at few places to update the view.
> Every
> where stored procedures are used extensively instead of t-sql. In sp at
> places table variables are used to minimise locks.
> In the initial phase only with each database having few thousand records
> user start getting timeout ,slow response & blocking complaints.
> Should I copy the view to have local copy of data and have job that run
> every min or 2 to update local table . In that too I am not clear that how
> useful it will be to keep local copy bcz. it will grow huge in size with
> growth in all db.
> Very complex thing I see is continuous updates back and forth , which may
> keep local copy block for most of the time or else user wan't have latest
> data available in their app.
> Any one who has worked with similar situation can be lot more useful,
> I will highly appreciate any suggestions or discussions from sql
> experts.
> Thanks,
>
>
>
>
>
>
>
>|||Sameer
> I am having performance issues Timeout, blocking , long running stored
> procedures etc.
> Application is written in C sharp and uses database sql2000 sp3.
Have you started to investigate the queries? Have you defined indexes on the
tables?
http://www.sql-server-performance.com
"Sameer Raval" <Sameer Raval @.discussions.microsoft.com> wrote in message
news:DB036029-CA4E-463D-B475-19BCE875ACA7@.microsoft.com...
> I am having performance issues Timeout, blocking , long running stored
> procedures etc.
> Application is written in C sharp and uses database sql2000 sp3.
> I have about 25 databases, view is used that joins tables from all db with
> left outer join and multiple conditions in where clause.
> Online updates are taking place which again goes back to that particular
> table in spec. db. Triggers are used at few places to update the view.
Every
> where stored procedures are used extensively instead of t-sql. In sp at
> places table variables are used to minimise locks.
> In the initial phase only with each database having few thousand records
> user start getting timeout ,slow response & blocking complaints.
> Should I copy the view to have local copy of data and have job that run
> every min or 2 to update local table . In that too I am not clear that how
> useful it will be to keep local copy bcz. it will grow huge in size with
> growth in all db.
> Very complex thing I see is continuous updates back and forth , which may
> keep local copy block for most of the time or else user wan't have latest
> data available in their app.
> Any one who has worked with similar situation can be lot more useful,
> I will highly appreciate any suggestions or discussions from sql
experts.
> Thanks,
>
>
>
>
>
>
>
>

Friday, March 9, 2012

HELP - Slow Connection establishment on Windows XP

Hi All,

Just bought a new laptop, everything fine EXCEPT when a java program I have written tries to get a connection to an SQL server database. It gets the connection no problem but its about three times slower than on my desktop machine to the same server.

The laptop is running windows XP Home, and I am connecting to an SQL server database.

I have absolutely no IDEA why it takes three times longer on a machine which is 10 times faster than my desktop. My desktop is running windows NT.

Any hints would be most appreciated.

thanks.Those 56k modems can be a dog...

;-)

How are you connecting to sql server..can you show us the connection string?|||its ok, the problem was that I had to put the sql server machine in the hosts file in windows\system32\drivers\etc

i.e. 123.123.123.123 servername.

thanks anyway.