Friday, March 30, 2012
Help How Make Backup and Restore ?
I need make Backup from specific tables of my database and my application send this file by mail to other users that restore this information in yours Database.
How i can do it (i dont know the specifics commands to backup and Restore)
Other question
if I only backup the log file and restores this in other database
I'll have the same information in all users ?
Help me please
Thanks in AdvanceCheck BOL on the syntax. You can place your specific tables on filegroups and have your users restore those filegroups after initial full db restore.|||Check BOL on the syntax. You can place your specific tables on filegroups and have your users restore those filegroups after initial full db restore.
Excuse me, but i don't understand what is BOL. ?
How i said i'm newbie.|||Books
On
Line|||Originally posted by rdjabarov
Books
On
Line
Thanks, I will Try.|||I connect like database admin and
try to make differential backup using this command
1- Back up Database Cyber to XXX With Differential
2- Back up Log Cyber to XXX
The to test the back up
I run then this restore command
1- Restore database Cyber from XXX with norecovery and
2- Restore Log Cyber from XXX with recovery.
All is perfect
I close the connection
When I try to connect to Cyber database the server send me this message
Server Msg 927, Level 14 State 2
Database Cyber Cannot Be opened. It is in the middle of restore ?
Why the database cannot be opened ?
Thank In advance
Franklin|||Are you trying to open it from Enterprise Manager? I suspect that if you right-mouse click on Databases folder and select Refresh, - you won't get this error.|||I'm trying to open from query analizer, because my application must be do it (the backup - restore) using transaq - sql.
thanks
franklin
Originally posted by rdjabarov
Are you trying to open it from Enterprise Manager? I suspect that if you right-mouse click on Databases folder and select Refresh, - you won't get this error.sql
Wednesday, March 28, 2012
Help for thin SQL Server
I am a newbie to the SQL server.
In my project,I need a SQL server in minimal size to meet the XPE
environment.
How can I get the goal mentioned above?
Where can I find the technical articles or files needed for building minimal
SQL?
Any hints are appreciated!
Best regards!
MerryMerry.Win wrote:
> Hi,everyone
> I am a newbie to the SQL server.
> In my project,I need a SQL server in minimal size to meet the XPE
> environment.
> How can I get the goal mentioned above?
> Where can I find the technical articles or files needed for building minimal
> SQL?
> Any hints are appreciated!
> Best regards!
> Merry`
A good place to start is the SQL Server Home Page:
http://www.microsoft.com/sql/default.mspx
Check out SQL Server Mobile:
http://www.microsoft.com/sql/editions/sqlmobile/default.mspx
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Help for thin SQL Server
I am a newbie to the SQL server.
In my project,I need a SQL server in minimal size to meet the XPE
environment.
How can I get the goal mentioned above?
Where can I find the technical articles or files needed for building minimal
SQL?
Any hints are appreciated!
Best regards!
MerryMerry.Win wrote:
> Hi,everyone
> I am a newbie to the SQL server.
> In my project,I need a SQL server in minimal size to meet the XPE
> environment.
> How can I get the goal mentioned above?
> Where can I find the technical articles or files needed for building minim
al
> SQL?
> Any hints are appreciated!
> Best regards!
> Merry`
A good place to start is the SQL Server Home Page:
http://www.microsoft.com/sql/default.mspx
Check out SQL Server Mobile:
http://www.microsoft.com/sql/editio...le/default.mspx
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Help for Newbie: How to create an autonumber
I really need advise on how do I create a field that can generate autonumbering for eg. scenario
There are 3 types of service_id like CTXXXX, GPXXXX, and STXXXX (where XXXX are running numbers). What I need is to have the XXXX auto generate and running. Also if I were to delete an old record for example CT0033, the latest number eg. CT1111 will not be changed to cover up for the missing CT0033.
I apologize if the description is a bit improper, but I'm new to this. Really appreciate anyone that can help. Thanks!! :oI'd suggest the IDENTITY property when you create the table. You'll have to "decorate" the resulting number with the letters you need, but that's trivial.
-PatP|||my money's on access
and what do you mean by basic skills?
can you spell dba?
Is this homework?|||Sarcasm, Brett? How unlike you!
NOT!
:)
If all three of these services are stored in the same table, then you will run into difficulties with IDENTITY unless you don't mind each service being numbered consecutively. IDENTITY will autonumber for the entire table, but not for individual services within the table.
Your best bet is to store the last ID number used for each service in a separate table, and then use a trigger on your data table that looks up the last code used, increments it by 1, and creates the new services codes.
But this is not simple SQL.
An alternative would be to denormalize your data and store the services in separate tables each with their own IDENTITY property, but this is frowned upon for many good reasons.
Actually, your best course of action would be to drop the idea of creating these codes in the first place, since such pseudo-surrogate keys violate several principles of database application design. That is why they are difficult to code.
Help for Newbie!
I tried "SELECT TOP 3 * FROM tableXXX WHERE (FieldID<>(SELECT TOP 1 * FROM tableXXX ORDER BY FieldID DESC) ORDER BY FieldID DESC" but sure as heck it didn't work. Can anyone help?drop the * on the 2nd select and only qry for the pkval :
SELECT Top 3 *
FROM Contacts
WHERE idCont <> (SELECT Top 1 idCont FROM Contacts)|||Thank you, Mike. It works beautifully! The complete statement is:
SELECT Top 3 *
FROM tbl_XXX
WHERE (idXXX <>(SELECT Top 1 idXXX FROM tbl_XXX ORDER BY idXXX DESC))
ORDER BY idXXX DESC
Again, thank you. You are great help.
Monday, March 26, 2012
Help for a real newbie
A problem so simple I'm a little embarrassed to post it... I am setting up a trigger in which I want to, among other things, record the network ID of the user who performs the action that triggers the trigger. I know there is a variable or function out there to pull that information, but I can't find it, and have tried every variation of "login logname usr_id network_id....." I can find.
So first.... could somebody please tell me the variable or function that will return that piece of information. And second, if you also could point me to a good place, either in print or on line, to look up that kind of information, I would be most grateful.
Thanks.
Hello Leslie. The first thing to remember, there is no stupid question (well almost never
)
The second thing I will point you to is the Downloadable version of the "BOL" (Books On Line).
It can be found here. http://search.microsoft.com/results.aspx?mkt=en-US&setlang=en-US&q=SQL+BOL If you are using SQL 2005 then it will be the 4th link down. You should also be able to access this by hitting F1 in your Enterprise Manager or inside of SQL Studio. Then switch over to the Index.
Then remmeber that most variables in SQL that are global either scoped to the whole server or the current connection will usually begin with a @.@.. Typing the @.@. in the index will get you in the near vicinity.
I personally found the @.@.PROCID which
Returns the object identifier (ID) of the current Transact-SQL module. A Transact-SQL module can be a stored procedure, user-defined function, or trigger. @.@.PROCID cannot be specified in CLR modules or the in-process data access provider.
and @.@.SPID
Returns the session ID of the current user process.
Try both of those and see if one of those does what you are looking for.
Hope that helps. If you have further questions feel free to ask.
|||Hi Leslie,
I think you're after the SYSTEM_USER function, which will return the windows login name in the form of ADomain\AUser (if the current user has used a trusted win connection of course).
Cheers,
Rob
Help for a newbie with an SQL Query
Not sure if this is where I should post this question or not but couldn't
find anywhere else to post. Please bear with me.
I am trying to structure a simple SQL query that will return all records
whose date is less than the current system date. I've read a number of basic
tutorials, but can't seem to find how to do this. Iv'e tried using the
following statement, but get errors:
SELECT ServiceTicketEntry.* FROM ServiceTicketEntry WHERE
sysdate()>ServiceTicketEntry.Call_Date
Can anyone give me a quick answer or point me to a good resource? Thanks in
advance.
William
You are close. You can use the ANSI standard CURRENT_TIMESTAMP or the T-SQL
specific getdate() functions to get the current date and time. That would
make your query:
SELECT ServiceTicketEntry.*
FROM ServiceTicketEntry
WHERE getdate() > ServiceTicketEntry.Call_Date
You might want to look at the DATEADD function to manipulate dates.
Remember to adjust the current-date derived functions rather than the
column-based dates. In other words, calculate a date and compare a column
to it rather than calculate each column and compar it to today's date.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"William" <William@.discussions.microsoft.com> wrote in message
news:DD4BF13D-1485-4930-B461-FBA72900EE26@.microsoft.com...
> Hi,
> Not sure if this is where I should post this question or not but couldn't
> find anywhere else to post. Please bear with me.
> I am trying to structure a simple SQL query that will return all records
> whose date is less than the current system date. I've read a number of
basic
> tutorials, but can't seem to find how to do this. Iv'e tried using the
> following statement, but get errors:
> SELECT ServiceTicketEntry.* FROM ServiceTicketEntry WHERE
> sysdate()>ServiceTicketEntry.Call_Date
> Can anyone give me a quick answer or point me to a good resource? Thanks
in
> advance.
> William
sql
Help for a newbie with an SQL Query
Not sure if this is where I should post this question or not but couldn't
find anywhere else to post. Please bear with me.
I am trying to structure a simple SQL query that will return all records
whose date is less than the current system date. I've read a number of basic
tutorials, but can't seem to find how to do this. Iv'e tried using the
following statement, but get errors:
SELECT ServiceTicketEntry.* FROM ServiceTicketEntry WHERE
sysdate()>ServiceTicketEntry.Call_Date
Can anyone give me a quick answer or point me to a good resource? Thanks in
advance.
WilliamYou are close. You can use the ANSI standard CURRENT_TIMESTAMP or the T-SQL
specific getdate() functions to get the current date and time. That would
make your query:
SELECT ServiceTicketEntry.*
FROM ServiceTicketEntry
WHERE getdate() > ServiceTicketEntry.Call_Date
You might want to look at the DATEADD function to manipulate dates.
Remember to adjust the current-date derived functions rather than the
column-based dates. In other words, calculate a date and compare a column
to it rather than calculate each column and compar it to today's date.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"William" <William@.discussions.microsoft.com> wrote in message
news:DD4BF13D-1485-4930-B461-FBA72900EE26@.microsoft.com...
> Hi,
> Not sure if this is where I should post this question or not but couldn't
> find anywhere else to post. Please bear with me.
> I am trying to structure a simple SQL query that will return all records
> whose date is less than the current system date. I've read a number of
basic
> tutorials, but can't seem to find how to do this. Iv'e tried using the
> following statement, but get errors:
> SELECT ServiceTicketEntry.* FROM ServiceTicketEntry WHERE
> sysdate()>ServiceTicketEntry.Call_Date
> Can anyone give me a quick answer or point me to a good resource? Thanks
in
> advance.
> William
Help for a newbie with an SQL Query
Not sure if this is where I should post this question or not but couldn't
find anywhere else to post. Please bear with me.
I am trying to structure a simple SQL query that will return all records
whose date is less than the current system date. I've read a number of basi
c
tutorials, but can't seem to find how to do this. Iv'e tried using the
following statement, but get errors:
SELECT ServiceTicketEntry.* FROM ServiceTicketEntry WHERE
sysdate()>ServiceTicketEntry.Call_Date
Can anyone give me a quick answer or point me to a good resource? Thanks in
advance.
WilliamYou are close. You can use the ANSI standard CURRENT_TIMESTAMP or the T-SQL
specific getdate() functions to get the current date and time. That would
make your query:
SELECT ServiceTicketEntry.*
FROM ServiceTicketEntry
WHERE getdate() > ServiceTicketEntry.Call_Date
You might want to look at the DATEADD function to manipulate dates.
Remember to adjust the current-date derived functions rather than the
column-based dates. In other words, calculate a date and compare a column
to it rather than calculate each column and compar it to today's date.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"William" <William@.discussions.microsoft.com> wrote in message
news:DD4BF13D-1485-4930-B461-FBA72900EE26@.microsoft.com...
> Hi,
> Not sure if this is where I should post this question or not but couldn't
> find anywhere else to post. Please bear with me.
> I am trying to structure a simple SQL query that will return all records
> whose date is less than the current system date. I've read a number of
basic
> tutorials, but can't seem to find how to do this. Iv'e tried using the
> following statement, but get errors:
> SELECT ServiceTicketEntry.* FROM ServiceTicketEntry WHERE
> sysdate()>ServiceTicketEntry.Call_Date
> Can anyone give me a quick answer or point me to a good resource? Thanks
in
> advance.
> William
Monday, March 19, 2012
Help a Newbie Out... SQL Learning...
English Classes and other requirements, but soon that will be over
with. I wanted to get a head start with SQL, I installed SQL 2005
Server Standard Edition, not the Enterprise one.
I installed it on my Laptop for learning purposes running Windows XP
Pro SP2, and it runs just fine. So I used some of the Tools to view
the tree of everything, the Tables and all that, but here is my
question.
Before I go on, the only experiance with SQL I have is from Linux,
working with the mysqlOpen Source package, so I know some of the
commands for viewing Tables and all that and creating them, but nothing
too complex past this point, no scripting, however I do know VBA for
Excel and some with Access.
For someone new like me, where should I start ?
I have lots of Excel experiance, am good at it and also am good in
Access.
With Access you can create your Tables and put the data in there, the
FORMs and all that.
But with SQL, I am confused as to how to create the TABLES with the set
of tools that came with it. Is there a totally different product that
I must use to create the tables on the locahost for learning purposes
or what ?
Which books should I buy ?
Thanks for your input!!!!I figured out how to create a new Database using the SQL Server
Management Studio Tool, and then I created a Table too and now I am
creating the Table contents, different Columns.
What is the best way to enter the data into the Table ?
Are there like FORMs that exists, where once the Table is setup, people
can enter the datainto the Table remotely, say within the local
network, here where I work ?
Thanks!!!
RompStar wrote:
> I am attanding school for Database Administration, still taking all the
> English Classes and other requirements, but soon that will be over
> with. I wanted to get a head start with SQL, I installed SQL 2005
> Server Standard Edition, not the Enterprise one.
> I installed it on my Laptop for learning purposes running Windows XP
> Pro SP2, and it runs just fine. So I used some of the Tools to view
> the tree of everything, the Tables and all that, but here is my
> question.
> Before I go on, the only experiance with SQL I have is from Linux,
> working with the mysqlOpen Source package, so I know some of the
> commands for viewing Tables and all that and creating them, but nothing
> too complex past this point, no scripting, however I do know VBA for
> Excel and some with Access.
> For someone new like me, where should I start ?
> I have lots of Excel experiance, am good at it and also am good in
> Access.
> With Access you can create your Tables and put the data in there, the
> FORMs and all that.
> But with SQL, I am confused as to how to create the TABLES with the set
> of tools that came with it. Is there a totally different product that
> I must use to create the tables on the locahost for learning purposes
> or what ?
> Which books should I buy ?
> Thanks for your input!!!!|||On 12 Sep 2006 15:49:44 -0700, "RompStar" <rmiecznik@.comcast.net>
wrote:
>But with SQL, I am confused as to how to create the TABLES with the set
>of tools that came with it. Is there a totally different product that
>I must use to create the tables on the locahost for learning purposes
>or what ?
You should learn to create tables using the query window built into
Management Studio. Forget the GUI tools for building tables, at least
until you can do them easily as straight CREATE TABLE commands. The
same goes for creating views and stored procedures. Anyone who
intends to function as a DBA has to be able to work that way. So open
up the Books on Line, and start learning the command syntax.
The GUI tools are fine for viewing what objects exist and how they are
defined, however.
Roy Harvey
Beacon Falls, CT|||RompStar wrote:
> I figured out how to create a new Database using the SQL Server
> Management Studio Tool, and then I created a Table too and now I am
> creating the Table contents, different Columns.
> What is the best way to enter the data into the Table ?
> Are there like FORMs that exists, where once the Table is setup, people
> can enter the datainto the Table remotely, say within the local
> network, here where I work ?
> Thanks!!!
>
> RompStar wrote:
>
>
Hi
SQL Server it self hasn't got any "input" interface for users. You can
to some extend work with data from SQL Server Management Studio and you
can write all the queries you like from Query Analyzer (or Query Editor
as I think it's called in Management Studio) but that's not for regular
users.
Instead you'll have to either create some forms etc. in Access and then
use a SQL server Table as storage or you'll have to write your own
application.
Regards
Steen Schlter Persson
Databaseadministrator / Systemadministrator|||Great, good info. I am not afraid to use commands, that's all one uses
when running servers using Sun OS and Linux, I am used to running that
for over 12 years.
I prefer command line anyways.
Which books are boog for beginners, I want to learn all the syntax, and
whatever programming tools they offer, like in Access I can do VBA, and
examples on how to develop different FORMs.
Please recommend books for a Newbie, I want to do very well in all my
classes, thus why I am getting a head starts, I won't start my classes
for about another 6 months.
Thanks!
Steen Persson (DK) wrote:
> RompStar wrote:
> Hi
> SQL Server it self hasn't got any "input" interface for users. You can
> to some extend work with data from SQL Server Management Studio and you
> can write all the queries you like from Query Analyzer (or Query Editor
> as I think it's called in Management Studio) but that's not for regular
> users.
> Instead you'll have to either create some forms etc. in Access and then
> use a SQL server Table as storage or you'll have to write your own
> application.
>
> --
> Regards
> Steen Schl=FCter Persson
> Databaseadministrator / Systemadministrator|||"RompStar" <rmiecznik@.comcast.net> wrote in message
news:1158102439.117633.76600@.m73g2000cwd.googlegroups.com...
> Are there like FORMs that exists, where once the Table is setup, people
> can enter the datainto the Table remotely, say within the local
> network, here where I work ?
If you have a background in Access, you might check out Access Data
Projects. Basically, you use Access as a front-end interface to SQL's
back-end. It is similar to a 'regular' Access MDB database.
Jonathan
Help a Newbie Out... SQL Learning...
English Classes and other requirements, but soon that will be over
with. I wanted to get a head start with SQL, I installed SQL 2005
Server Standard Edition, not the Enterprise one.
I installed it on my Laptop for learning purposes running Windows XP
Pro SP2, and it runs just fine. So I used some of the Tools to view
the tree of everything, the Tables and all that, but here is my
question.
Before I go on, the only experiance with SQL I have is from Linux,
working with the MySQL Open Source package, so I know some of the
commands for viewing Tables and all that and creating them, but nothing
too complex past this point, no scripting, however I do know VBA for
Excel and some with Access.
For someone new like me, where should I start ?
I have lots of Excel experiance, am good at it and also am good in
Access.
With Access you can create your Tables and put the data in there, the
FORMs and all that.
But with SQL, I am confused as to how to create the TABLES with the set
of tools that came with it. Is there a totally different product that
I must use to create the tables on the locahost for learning purposes
or what ?
Which books should I buy ?
Thanks for your input!!!!I figured out how to create a new Database using the SQL Server
Management Studio Tool, and then I created a Table too and now I am
creating the Table contents, different Columns.
What is the best way to enter the data into the Table ?
Are there like FORMs that exists, where once the Table is setup, people
can enter the datainto the Table remotely, say within the local
network, here where I work ?
Thanks!!!
RompStar wrote:
> I am attanding school for Database Administration, still taking all the
> English Classes and other requirements, but soon that will be over
> with. I wanted to get a head start with SQL, I installed SQL 2005
> Server Standard Edition, not the Enterprise one.
> I installed it on my Laptop for learning purposes running Windows XP
> Pro SP2, and it runs just fine. So I used some of the Tools to view
> the tree of everything, the Tables and all that, but here is my
> question.
> Before I go on, the only experiance with SQL I have is from Linux,
> working with the MySQL Open Source package, so I know some of the
> commands for viewing Tables and all that and creating them, but nothing
> too complex past this point, no scripting, however I do know VBA for
> Excel and some with Access.
> For someone new like me, where should I start ?
> I have lots of Excel experiance, am good at it and also am good in
> Access.
> With Access you can create your Tables and put the data in there, the
> FORMs and all that.
> But with SQL, I am confused as to how to create the TABLES with the set
> of tools that came with it. Is there a totally different product that
> I must use to create the tables on the locahost for learning purposes
> or what ?
> Which books should I buy ?
> Thanks for your input!!!!|||On 12 Sep 2006 15:49:44 -0700, "RompStar" <rmiecznik@.comcast.net>
wrote:
>But with SQL, I am confused as to how to create the TABLES with the set
>of tools that came with it. Is there a totally different product that
>I must use to create the tables on the locahost for learning purposes
>or what ?
You should learn to create tables using the query window built into
Management Studio. Forget the GUI tools for building tables, at least
until you can do them easily as straight CREATE TABLE commands. The
same goes for creating views and stored procedures. Anyone who
intends to function as a DBA has to be able to work that way. So open
up the Books on Line, and start learning the command syntax.
The GUI tools are fine for viewing what objects exist and how they are
defined, however.
Roy Harvey
Beacon Falls, CT|||RompStar wrote:
> I figured out how to create a new Database using the SQL Server
> Management Studio Tool, and then I created a Table too and now I am
> creating the Table contents, different Columns.
> What is the best way to enter the data into the Table ?
> Are there like FORMs that exists, where once the Table is setup, people
> can enter the datainto the Table remotely, say within the local
> network, here where I work ?
> Thanks!!!
>
> RompStar wrote:
>> I am attanding school for Database Administration, still taking all the
>> English Classes and other requirements, but soon that will be over
>> with. I wanted to get a head start with SQL, I installed SQL 2005
>> Server Standard Edition, not the Enterprise one.
>> I installed it on my Laptop for learning purposes running Windows XP
>> Pro SP2, and it runs just fine. So I used some of the Tools to view
>> the tree of everything, the Tables and all that, but here is my
>> question.
>> Before I go on, the only experiance with SQL I have is from Linux,
>> working with the MySQL Open Source package, so I know some of the
>> commands for viewing Tables and all that and creating them, but nothing
>> too complex past this point, no scripting, however I do know VBA for
>> Excel and some with Access.
>> For someone new like me, where should I start ?
>> I have lots of Excel experiance, am good at it and also am good in
>> Access.
>> With Access you can create your Tables and put the data in there, the
>> FORMs and all that.
>> But with SQL, I am confused as to how to create the TABLES with the set
>> of tools that came with it. Is there a totally different product that
>> I must use to create the tables on the locahost for learning purposes
>> or what ?
>> Which books should I buy ?
>> Thanks for your input!!!!
>
Hi
SQL Server it self hasn't got any "input" interface for users. You can
to some extend work with data from SQL Server Management Studio and you
can write all the queries you like from Query Analyzer (or Query Editor
as I think it's called in Management Studio) but that's not for regular
users.
Instead you'll have to either create some forms etc. in Access and then
use a SQL server Table as storage or you'll have to write your own
application.
Regards
Steen Schlüter Persson
Databaseadministrator / Systemadministrator|||Great, good info. I am not afraid to use commands, that's all one uses
when running servers using Sun OS and Linux, I am used to running that
for over 12 years.
I prefer command line anyways.
Which books are boog for beginners, I want to learn all the syntax, and
whatever programming tools they offer, like in Access I can do VBA, and
examples on how to develop different FORMs.
Please recommend books for a Newbie, I want to do very well in all my
classes, thus why I am getting a head starts, I won't start my classes
for about another 6 months.
Thanks!
Steen Persson (DK) wrote:
> RompStar wrote:
> > I figured out how to create a new Database using the SQL Server
> > Management Studio Tool, and then I created a Table too and now I am
> > creating the Table contents, different Columns.
> >
> > What is the best way to enter the data into the Table ?
> >
> > Are there like FORMs that exists, where once the Table is setup, people
> > can enter the datainto the Table remotely, say within the local
> > network, here where I work ?
> >
> > Thanks!!!
> >
> >
> > RompStar wrote:
> >
> >> I am attanding school for Database Administration, still taking all the
> >> English Classes and other requirements, but soon that will be over
> >> with. I wanted to get a head start with SQL, I installed SQL 2005
> >> Server Standard Edition, not the Enterprise one.
> >>
> >> I installed it on my Laptop for learning purposes running Windows XP
> >> Pro SP2, and it runs just fine. So I used some of the Tools to view
> >> the tree of everything, the Tables and all that, but here is my
> >> question.
> >>
> >> Before I go on, the only experiance with SQL I have is from Linux,
> >> working with the MySQL Open Source package, so I know some of the
> >> commands for viewing Tables and all that and creating them, but nothing
> >> too complex past this point, no scripting, however I do know VBA for
> >> Excel and some with Access.
> >>
> >> For someone new like me, where should I start ?
> >>
> >> I have lots of Excel experiance, am good at it and also am good in
> >> Access.
> >>
> >> With Access you can create your Tables and put the data in there, the
> >> FORMs and all that.
> >>
> >> But with SQL, I am confused as to how to create the TABLES with the set
> >> of tools that came with it. Is there a totally different product that
> >> I must use to create the tables on the locahost for learning purposes
> >> or what ?
> >>
> >> Which books should I buy ?
> >>
> >> Thanks for your input!!!!
> >>
> >
> >
> Hi
> SQL Server it self hasn't got any "input" interface for users. You can
> to some extend work with data from SQL Server Management Studio and you
> can write all the queries you like from Query Analyzer (or Query Editor
> as I think it's called in Management Studio) but that's not for regular
> users.
> Instead you'll have to either create some forms etc. in Access and then
> use a SQL server Table as storage or you'll have to write your own
> application.
>
> --
> Regards
> Steen Schl=FCter Persson
> Databaseadministrator / Systemadministrator|||"RompStar" <rmiecznik@.comcast.net> wrote in message
news:1158102439.117633.76600@.m73g2000cwd.googlegroups.com...
> Are there like FORMs that exists, where once the Table is setup, people
> can enter the datainto the Table remotely, say within the local
> network, here where I work ?
If you have a background in Access, you might check out Access Data
Projects. Basically, you use Access as a front-end interface to SQL's
back-end. It is similar to a 'regular' Access MDB database.
Jonathan
help a newbie
going to implement full text searches so i've got some dumb questions.
1) is the only way to make the fulltext searches realtime, ie document
is indexed immediately after being added to the db, is to enable change
tracking and update index in the background and add a timestamp column
to each table to be indexed?
2) once the change tracking is working, is there any reason to schedule
full or incremental population?
3) my catalog has 4 tables in it. is there any way to enable change
tracking and update index in background for the entire catalog or do i
have to go to each table and enable it?
4) is it better to have one catalog per db or one catalog per table?
5) the population really kills my cpu. my development server has dual
p3 at 500mhz and 1 gig of ram. the test db has about 500mb of
text/image data (pdf, doc, ppt, etc) in it. the population takes about
10 minutes to run and the mssdmn process stays at a minimum of 50% cpu.
is this normal? this goes along with #3 because everytime i go enable
change tracking on a table, it starts a repopulation.
6) what's more important for populating fulltext indexes, cpu speed or
disk speed?
7) people can upload any kind of document into these 4 tables including
jpg, gif, bmp. fulltext tries to index these and generates an error in
eventlog. any way to tell it to not index files of those types?
8) backup and recovery is very important here, as it should be
everywhere. what's the best way to restore a db that has fulltext
indexes? restore from backup and rebuild catalogs or try to restore the
catalog files along with the db?
CH,
See answers to your questions inline below starting with [jtkane].
Regards,
John
"ch" <ch@.dontemailme.com> wrote in message
news:408531A7.E2AF907A@.dontemailme.com...
> i've been a sql server dba for the last six years, but we're just now
> going to implement full text searches so i've got some dumb questions.
> 1) is the only way to make the fulltext searches realtime, ie document
> is indexed immediately after being added to the db, is to enable change
> tracking and update index in the background and add a timestamp column
> to each table to be indexed?
[jtkane] - Yes and assuming you're using SQL Server 2000 as CT and UIiB are
new features in SQL Server 2000. Although adding a timestamp column is not
required for CT and UIiB, but recommended as when you enable a populated FT
Catalog, CT will automaticlly run an Incremental Population to re-sync the
table with the FT Catalog, otherwise a Full Population will be executed.
> 2) once the change tracking is working, is there any reason to schedule
> full or incremental population?
[jtkane] - A Full Population, no, unless you have a need to change the
related noise word file, i.e., add or remove noise words. As for
Incremental, yes, depending upon the amount of change, i.e,
inserts/updates/deletes that affect over 60% of the rows in the FT enabled
table. See SQL Server BOL title "Maintaining Full-Text Indexes" for more
info on this.
> 3) my catalog has 4 tables in it. is there any way to enable change
> tracking and update index in background for the entire catalog or do i
> have to go to each table and enable it?
[jtkane] - CT and UIiB are set at the table level, so you would need to
enable each table. Note, this can be easly done in the Enterprise Manager.
However, considering the answer to number 2 above, and if these are large
(>1 million rows) tables, you should do enable these tables one at a time,
until the re-sync Incremental Population has completed and then enable the
next table...
> 4) is it better to have one catalog per db or one catalog per table?
[jtkane] - The answer to this question is that it depends. See the last
paragraph in SQL Server BOL title "Full-text Search Recommendation" for more
info on this question. Additionally, having mutiple tables in one FT
Catalogs can affect the value of RANK, if you use this column in your
CONTAINSTABLE or FREETEXTTABLE queries.
> 5) the population really kills my cpu. my development server has dual
> p3 at 500mhz and 1 gig of ram. the test db has about 500mb of
> text/image data (pdf, doc, ppt, etc) in it. the population takes about
> 10 minutes to run and the mssdmn process stays at a minimum of 50% cpu.
> is this normal? this goes along with #3 because everytime i go enable
> change tracking on a table, it starts a repopulation.
[jtkane] - Yes. This is is normal and expected during either the "shadow
merge" or "Master Merge" processes that the MSSearch service does to merge
new "word lists" into it's file system and then at the end of this process
or at midnight (controllable via a registry key). This process occurs during
either a Full or Incremental Population and at midnight for CT & UIiB
enabled tables.
For multi-proc servers, you can set the CPU affinity of the MSSearch service
(or any other service) via launching the following at the AT command prompt
as the sysadmin of the machine where SQL Server is installed using the
following syntax:
at <current_time_plus_1_min> /interactive taskmgr.exe
then once the TaskMgr is running, right-click on the MSSearch service and
set the CPU to one CPU and then use sp_configure and set the CPU affinity
for SQL Server to the other CPU for your dual proc server. This will ensure
that the MSSearch CPU usage will not affect your SQL Server processes during
it's high CPU usage periods.
> 6) what's more important for populating fulltext indexes, cpu speed or
> disk speed?
[jtkane] - All are important, depending what you are trying to optmize. See
SQL Server BOL title "Full-text Search Recommendation" for more info on this
issue. Note, the amount of L3 cache on the CPU is also important.
> 7) people can upload any kind of document into these 4 tables including
> jpg, gif, bmp. fulltext tries to index these and generates an error in
> eventlog. any way to tell it to not index files of those types?
[jtkane] - Yes. All errors, warnings and informational events for FTS and
MSSearch are recorded in the server's Appliation event log and not SQL
Server's errorlog files.
> 8) backup and recovery is very important here, as it should be
> everywhere. what's the best way to restore a db that has fulltext
> indexes? restore from backup and rebuild catalogs or try to restore the
> catalog files along with the db?
[jtkane] - Yes, I agree. For more info on backing up and restoring FT
Catalogs, see KB article 240867 (Q240867) "INF: How to Move, Copy, and
Backup Full-Text Catalog Folders and Files" at
http://support.microsoft.com/default...b;EN-US;240867
Note, SQL Server 2005 (codename Yukon) will fully integrate FT Catalogs into
SQL Server's backup and restore commands.
>
>
Friday, March 9, 2012
Help - Simple Question
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
DECLARE @.rc INT;
SELECT ... FROM table1 WHERE ... ;
SET @.rc = @.@.ROWCOUNT;
IF @.rc > 0
SELECT ... FROM table2 WHERE ... ;
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
Ugh. I am sure what you are doing could be done with a simple join, rather
than a nested cursor of some kind, which should be avoided at all costs (in
most situations). If you can do a better job describing exactly what you
want to do (see http://www.aspfaq.com/5006 )... I am sure someone can help
you with a much more efficient, set-based approach.
A|||Without seeing your DDL - and the query - it's hard to say. Perhaps what
you want is a derived table or Common Table Expression.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
I am running a T-SQL query and if there are one or more records returned by
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.|||Code
BOL's example
USE pubs
DECLARE @.RowCount int
EXEC sp_executesql
N'SELECT @.RowCount = COUNT(*) FROM authors',
N'@.RowCount int OUTPUT',
@.RowCount OUTPUT
RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
>
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
>|||Thank, you this is enough to get me going again!
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23d26T0yVGHA.5580@.TK2MSFTNGP11.phx.gbl...
> DECLARE @.rc INT;
> SELECT ... FROM table1 WHERE ... ;
> SET @.rc = @.@.ROWCOUNT;
> IF @.rc > 0
> SELECT ... FROM table2 WHERE ... ;
>
> Ugh. I am sure what you are doing could be done with a simple join,
> rather than a nested cursor of some kind, which should be avoided at all
> costs (in most situations). If you can do a better job describing exactly
> what you want to do (see http://www.aspfaq.com/5006 )... I am sure someone
> can help you with a much more efficient, set-based approach.
> A
>|||Uri, wy do you resort to dynamic SQL here?
> Code
> BOL's example
> USE pubs
> DECLARE @.RowCount int
> EXEC sp_executesql
> N'SELECT @.RowCount = COUNT(*) FROM authors',
> N'@.RowCount int OUTPUT',
> @.RowCount OUTPUT
> RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)|||u need to give more information on what is it that you want to select.
for a newbie try to unlearn whatever you have learnt about cursors :)
you need to look at the result set as a whole when you are processing and
not a single record ar a time.|||No attack :-)))) Yep , I was reading some article in the BOL and just put
this examle out .
It is probably time to go home after very long work day
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OsSRF3yVGHA.4340@.TK2MSFTNGP10.phx.gbl...
> Uri, wy do you resort to dynamic SQL here?
>
>|||I juz think Uri is trying to make a point.. And what would that be'|||Hello,
When you state:
> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
are you referring specifically to cursors or do you extend this thought to
everything
encompassed in a SELECT statement?I think your making a point but I want to
know
exactly what it is:)
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:4873AB17-3EF3-42B0-A389-C9927E899EC0@.microsoft.com...
> u need to give more information on what is it that you want to select.
> for a newbie try to unlearn whatever you have learnt about cursors :)
> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
Help - Simple Question
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
DECLARE @.rc INT;
SELECT ... FROM table1 WHERE ... ;
SET @.rc = @.@.ROWCOUNT;
IF @.rc > 0
SELECT ... FROM table2 WHERE ... ;
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
Ugh. I am sure what you are doing could be done with a simple join, rather
than a nested cursor of some kind, which should be avoided at all costs (in
most situations). If you can do a better job describing exactly what you
want to do (see http://www.aspfaq.com/5006 )... I am sure someone can help
you with a much more efficient, set-based approach.
A|||Without seeing your DDL - and the query - it's hard to say. Perhaps what
you want is a derived table or Common Table Expression.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
I am running a T-SQL query and if there are one or more records returned by
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.|||Code
BOL's example
USE pubs
DECLARE @.RowCount int
EXEC sp_executesql
N'SELECT @.RowCount = COUNT(*) FROM authors',
N'@.RowCount int OUTPUT',
@.RowCount OUTPUT
RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
>
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
>|||Thank, you this is enough to get me going again!
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in mess
age
news:%23d26T0yVGHA.5580@.TK2MSFTNGP11.phx.gbl...
> DECLARE @.rc INT;
> SELECT ... FROM table1 WHERE ... ;
> SET @.rc = @.@.ROWCOUNT;
> IF @.rc > 0
> SELECT ... FROM table2 WHERE ... ;
>
> Ugh. I am sure what you are doing could be done with a simple join,
> rather than a nested cursor of some kind, which should be avoided at all
> costs (in most situations). If you can do a better job describing exactly
> what you want to do (see http://www.aspfaq.com/5006 )... I am sure someone
> can help you with a much more efficient, set-based approach.
> A
>|||Uri, wy do you resort to dynamic SQL here?
> Code
> BOL's example
> USE pubs
> DECLARE @.RowCount int
> EXEC sp_executesql
> N'SELECT @.RowCount = COUNT(*) FROM authors',
> N'@.RowCount int OUTPUT',
> @.RowCount OUTPUT
> RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)|||u need to give more information on what is it that you want to select.
for a newbie try to unlearn whatever you have learnt about cursors

you need to look at the result set as a whole when you are processing and
not a single record ar a time.|||No attack :-)))) Yep , I was reading some article in the BOL and just put
this examle out .
It is probably time to go home after very long work day
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in mess
age
news:OsSRF3yVGHA.4340@.TK2MSFTNGP10.phx.gbl...
> Uri, wy do you resort to dynamic SQL here?
>
>|||I juz think Uri is trying to make a point.. And what would that be'|||Hello,
When you state:
> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
are you referring specifically to cursors or do you extend this thought to
everything
encompassed in a SELECT statement?I think your making a point but I want to
know
exactly what it is

"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:4873AB17-3EF3-42B0-A389-C9927E899EC0@.microsoft.com...
> u need to give more information on what is it that you want to select.
> for a newbie try to unlearn whatever you have learnt about cursors

> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
Help - Simple Question
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.
>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
DECLARE @.rc INT;
SELECT ... FROM table1 WHERE ... ;
SET @.rc = @.@.ROWCOUNT;
IF @.rc > 0
SELECT ... FROM table2 WHERE ... ;
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
Ugh. I am sure what you are doing could be done with a simple join, rather
than a nested cursor of some kind, which should be avoided at all costs (in
most situations). If you can do a better job describing exactly what you
want to do (see http://www.aspfaq.com/5006 )... I am sure someone can help
you with a much more efficient, set-based approach.
A
|||Without seeing your DDL - and the query - it's hard to say. Perhaps what
you want is a derived table or Common Table Expression.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
..
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
I am running a T-SQL query and if there are one or more records returned by
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.
|||Code
BOL's example
USE pubs
DECLARE @.RowCount int
EXEC sp_executesql
N'SELECT @.RowCount = COUNT(*) FROM authors',
N'@.RowCount int OUTPUT',
@.RowCount OUTPUT
RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
>
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
>
|||Thank, you this is enough to get me going again!
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23d26T0yVGHA.5580@.TK2MSFTNGP11.phx.gbl...
> DECLARE @.rc INT;
> SELECT ... FROM table1 WHERE ... ;
> SET @.rc = @.@.ROWCOUNT;
> IF @.rc > 0
> SELECT ... FROM table2 WHERE ... ;
>
> Ugh. I am sure what you are doing could be done with a simple join,
> rather than a nested cursor of some kind, which should be avoided at all
> costs (in most situations). If you can do a better job describing exactly
> what you want to do (see http://www.aspfaq.com/5006 )... I am sure someone
> can help you with a much more efficient, set-based approach.
> A
>
|||Uri, wy do you resort to dynamic SQL here?
> Code
> BOL's example
> USE pubs
> DECLARE @.RowCount int
> EXEC sp_executesql
> N'SELECT @.RowCount = COUNT(*) FROM authors',
> N'@.RowCount int OUTPUT',
> @.RowCount OUTPUT
> RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)
|||u need to give more information on what is it that you want to select.
for a newbie try to unlearn whatever you have learnt about cursors

you need to look at the result set as a whole when you are processing and
not a single record ar a time.
|||No attack :-)))) Yep , I was reading some article in the BOL and just put
this examle out .
It is probably time to go home after very long work day
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OsSRF3yVGHA.4340@.TK2MSFTNGP10.phx.gbl...
> Uri, wy do you resort to dynamic SQL here?
>
>
|||I juz think Uri is trying to make a point.. And what would that be?
|||Hello,
When you state:
> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
are you referring specifically to cursors or do you extend this thought to
everything
encompassed in a SELECT statement?I think your making a point but I want to
know
exactly what it is

"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:4873AB17-3EF3-42B0-A389-C9927E899EC0@.microsoft.com...
> u need to give more information on what is it that you want to select.
> for a newbie try to unlearn whatever you have learnt about cursors

> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
Help - Simple Question
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
DECLARE @.rc INT;
SELECT ... FROM table1 WHERE ... ;
SET @.rc = @.@.ROWCOUNT;
IF @.rc > 0
SELECT ... FROM table2 WHERE ... ;
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
Ugh. I am sure what you are doing could be done with a simple join, rather
than a nested cursor of some kind, which should be avoided at all costs (in
most situations). If you can do a better job describing exactly what you
want to do (see http://www.aspfaq.com/5006 )... I am sure someone can help
you with a much more efficient, set-based approach.
A|||Without seeing your DDL - and the query - it's hard to say. Perhaps what
you want is a derived table or Common Table Expression.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
I am running a T-SQL query and if there are one or more records returned by
it I need to run another query. How does a newbie like me determine this or
how do I get the value of the COUNT function into a variable I can use
elsewhere in my sproc?
After I see that the first query has records I am going to use values from
it to run the second query and I assume I am going to use a cursor to
accomplish this. Thank you.|||Thank, you this is enough to get me going again!
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23d26T0yVGHA.5580@.TK2MSFTNGP11.phx.gbl...
> >I am running a T-SQL query and if there are one or more records returned
> >by it I need to run another query. How does a newbie like me determine
> >this or how do I get the value of the COUNT function into a variable I
> >can use elsewhere in my sproc?
> DECLARE @.rc INT;
> SELECT ... FROM table1 WHERE ... ;
> SET @.rc = @.@.ROWCOUNT;
> IF @.rc > 0
> SELECT ... FROM table2 WHERE ... ;
>> After I see that the first query has records I am going to use values
>> from it to run the second query and I assume I am going to use a cursor
>> to accomplish this. Thank you.
> Ugh. I am sure what you are doing could be done with a simple join,
> rather than a nested cursor of some kind, which should be avoided at all
> costs (in most situations). If you can do a better job describing exactly
> what you want to do (see http://www.aspfaq.com/5006 )... I am sure someone
> can help you with a much more efficient, set-based approach.
> A
>|||Uri, wy do you resort to dynamic SQL here?
> Code
> BOL's example
> USE pubs
> DECLARE @.RowCount int
> EXEC sp_executesql
> N'SELECT @.RowCount = COUNT(*) FROM authors',
> N'@.RowCount int OUTPUT',
> @.RowCount OUTPUT
> RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)|||u need to give more information on what is it that you want to select.
for a newbie try to unlearn whatever you have learnt about cursors :)
you need to look at the result set as a whole when you are processing and
not a single record ar a time.|||No attack :-)))) Yep , I was reading some article in the BOL and just put
this examle out .
It is probably time to go home after very long work day
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OsSRF3yVGHA.4340@.TK2MSFTNGP10.phx.gbl...
> Uri, wy do you resort to dynamic SQL here?
>
>> Code
>> BOL's example
>> USE pubs
>> DECLARE @.RowCount int
>> EXEC sp_executesql
>> N'SELECT @.RowCount = COUNT(*) FROM authors',
>> N'@.RowCount int OUTPUT',
>> @.RowCount OUTPUT
>> RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)
>|||I juz think Uri is trying to make a point.. And what would that be'|||Code
BOL's example
USE pubs
DECLARE @.RowCount int
EXEC sp_executesql
N'SELECT @.RowCount = COUNT(*) FROM authors',
N'@.RowCount int OUTPUT',
@.RowCount OUTPUT
RAISERROR ('Authors rowcount is %d', 0, 1, @.RowCount)
"Code Boy" <CodeBoy@.microsoft.com> wrote in message
news:%23HoXwxyVGHA.2208@.TK2MSFTNGP15.phx.gbl...
>I am running a T-SQL query and if there are one or more records returned by
>it I need to run another query. How does a newbie like me determine this
>or how do I get the value of the COUNT function into a variable I can use
>elsewhere in my sproc?
>
> After I see that the first query has records I am going to use values from
> it to run the second query and I assume I am going to use a cursor to
> accomplish this. Thank you.
>|||Hello,
When you state:
> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
are you referring specifically to cursors or do you extend this thought to
everything
encompassed in a SELECT statement?I think your making a point but I want to
know
exactly what it is:)
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:4873AB17-3EF3-42B0-A389-C9927E899EC0@.microsoft.com...
> u need to give more information on what is it that you want to select.
> for a newbie try to unlearn whatever you have learnt about cursors :)
> you need to look at the result set as a whole when you are processing and
> not a single record ar a time.
Help - Simple DataGrid Problem in Vis. Studio 2003
As a relative newbie to SQL Server/ASP.NET I'm hoping someone here
can help with my problem. I'm developing a timesheet application in
ASP.NET C# using Visual Studio 2003 with a database built in MSDE.
One of my forms needs to return a simple list of resources from my
database. I have followed the guide on the MSDN libraries, but for
some reason I continuously get the same error message.
What I've done so far is Create the database, tables, and populate
with some sample data using using Server Explorer in Visual Studio. I
have
connected to the database (using integrated security) and I am
trying to get the contents of the Resource table to appear on my
form. I have then created a DataAdapter (tested the connection, set
the SQL as a simple SELECT * from Resource, etc), which also generates
an sqlConnection for me. To test this I have previewed the generated
data, and it returns what I want, so I
have chosen to generate a DataSet of this. I am then trying to get
this data into a simple DataGrid. On the properties of the DataGrid
I have changed the DataSource to point at my Dataset. As I
understand it, I then have to add the following to my Page Load
section of my code.
sqlConnection1.Open();
this.sqlDataAdapter1.Fill(this.dsResource);
sqlConnection1.Close();
The form builds fine, but when I browse to the particular form I get
the following error for the sqlConnection1.Open(); line
Exception Details: System.Data.SqlClient.SqlException: Cannot open
database requested in login 'SCMS'. Login fails. Login failed for
user 'AL-NOTEPAD\ASPNET'.
To me this is an error with my connection string. My database
instance is actually 'AL-NOTEPAD\VSDOTNET'. However the properties
for sqlConnection1 are pointing to the correct datasource. I do not
know why the application is looking for user 'AL-NOTEPAD\ASPNET'. It
does not exist, to my knowledge.
Any help with this would be greatly appreciated, as I get the same
error with my code for forms-based login...
Thanks in advance..thebison (alex.sinclair3@.btinternet.com) writes:
> The form builds fine, but when I browse to the particular form I get
> the following error for the sqlConnection1.Open(); line
> Exception Details: System.Data.SqlClient.SqlException: Cannot open
> database requested in login 'SCMS'. Login fails. Login failed for
> user 'AL-NOTEPAD\ASPNET'.
> To me this is an error with my connection string. My database
> instance is actually 'AL-NOTEPAD\VSDOTNET'. However the properties
> for sqlConnection1 are pointing to the correct datasource. I do not
> know why the application is looking for user 'AL-NOTEPAD\ASPNET'. It
> does not exist, to my knowledge.
I guess that's why the login fails. :-)
I believe this has to do with that IIS runs the in a context of a pre-
defined user, and IIS the tries to log in with integrated security,
but the ASPNET user have not been granted access to the database.
But you are probably better off asking in a newsgroup about ASP .Net.
At least I know very little about ASP .Net.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
Friday, February 24, 2012
Help
I am a Newbie here. There are few questions that i hope to get some answers here:
1. MS SQL is the same as Microsoft SQL??
2. Microsoft SQL server is to install at the server side only ?? how about the client side??
Sorry if i ask the stupid question because i really a NEWBIE. :o1. yes
2. depends. developers needs the developer tools. you can install the personal\developer edition with the server tools locally. Workstations using client server applications need the drivers.|||So SQL SERVER 2000 can be install in the windows XP??Can co-exits with other SQL server in the same PC??|||Yes, currently I have SQL Server 6 and 2000 installed on my client's PC|||Yes, currently I have SQL Server 6 and 2000 installed on my client's PC
Ummmm, what versions are you talking about?
6?|||Eh, i am not sure. As i know it is SQL server 2000 Enterprise. I had tried and it says is incompatible with the OS, only can install the client part. As i need to develop some program using the MS SQL, any suggestions which version should i use, and where can I actually get it? :rolleyes:|||Is there any tools that support MS SQL to manage the database? such as create table and make query?|||i think enterprise manager is helpful enough. for query u can open the table as query from enterprise manager.|||any sugesstion web site that i can download the trial version??|||Ummmm, what versions are you talking about?
6?
well,
I'm not 100% familiar with sql server. to be honest I don't like it at all, I work on it just becouse of my current client (busines is business :-)) anyway, this seems to me like version 6 (see attachement - it appears when it sturt up)|||i am going to use MS SQL 2000, but i have no idea about the version of the enterprise manager??!!|||Hi all, is me again! Finally i install the SQL Server Desktop engine and the client tools, but i still facing the problem to connect the SQL Server. Actually i do not know how to connect to the database. I have tried but the errors keep showing "Server not found". I really have no idea how to solve this. Anyone can help??