Showing posts with label back. Show all posts
Showing posts with label back. Show all posts

Thursday, March 22, 2012

Dataset Results

I have created adataset to make a drop down list for a parameter. As shown:

SELECT distinct [Table] FROM [Database]

The results i get back are A, B & C. What i am trying to do is show a result as a different word.

i.e instead of displaying A is shows in drop down list as Apple, B shows Banana. etc.

Can anyone help please.

Thanks

Lookup the usage of case(sql server). This should get you your desired result.|||The parameter can use two columns of the returned dataset, one for the value column and one for the display column, getting this back from the query and binding it to the appropiate properties in the parameter setting should help.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Ok got it working.

select distinct

case [COLUMN NAME]

when 'A' then 'Apple'

when 'B' then 'Banana'

else 'Unknown'end

from [TABLE NAME]

where [COLUMN NAME] in ('A', 'B', 'C')

Sunday, March 11, 2012

datamap

I had some problems with my SQL-program and had to re-install the program. Is it possible to copy the datamap back into th sql directory and use this data or is this only possible with a restore'
Regards,
MarcWhat's a 'datamap'?
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"fedum" <anonymous@.discussions.microsoft.com> wrote in message
news:82B772DB-A543-4A29-8872-9FB759118ADF@.microsoft.com...
> I had some problems with my SQL-program and had to re-install the program.
Is it possible to copy the datamap back into th sql directory and use this
data or is this only possible with a restore?
> Regards,
> Marc|||Perhaps fedum is referring to the mdf, ldf and ndf files? If so, fedum, check out sp_attach_db.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:%23vxpAP2sDHA.2408@.tk2msftngp13.phx.gbl...
> What's a 'datamap'?
>
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "fedum" <anonymous@.discussions.microsoft.com> wrote in message
> news:82B772DB-A543-4A29-8872-9FB759118ADF@.microsoft.com...
> > I had some problems with my SQL-program and had to re-install the program.
> Is it possible to copy the datamap back into th sql directory and use this
> data or is this only possible with a restore?
> > Regards,
> > Marc
>|||well I mean the directory under the MSSQL7 directory where sql stores his data. Because I have now resent backup from my data and therefore I would like to try if I could copy this data back under this directory
Regards
Marc|||See my post from yesterday.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"fedum" <anonymous@.discussions.microsoft.com> wrote in message
news:EDC83C7C-E88B-4313-9F4F-0C6B1306E6CD@.microsoft.com...
> well I mean the directory under the MSSQL7 directory where sql stores his data. Because I have now
resent backup from my data and therefore I would like to try if I could copy this data back under
this directory.
> Regards,
> Marc|||Thanks
But when I read the comment about sp_attach_db then it is allways combined with sp_detach_db. The problem is that the database is not detached before becouse of the problems withh SQL. Can I allso use the attach without detach' Can you please inform
Marc|||Sometimes sp_attach_db will work even if you didn't detach it first, sometimes it doesn't. Give it a
try!
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"fedum" <anonymous@.discussions.microsoft.com> wrote in message
news:90CF0F46-34BA-4881-9A6E-23E1E3233730@.microsoft.com...
> Thanks,
> But when I read the comment about sp_attach_db then it is allways combined with sp_detach_db. The
problem is that the database is not detached before becouse of the problems withh SQL. Can I allso
use the attach without detach' Can you please inform?
> Marc

Wednesday, March 7, 2012

Databse Offline

hi everyone
Could someone please help me in following:
One of my database in SQL 2000 going Offline automatically. When i
bring it back Online its Ok for 20/30 minutes and then again appear as
Offline. I had similar problem when one of the database keep going to
'Single user' automatically.
Any idea what happening.
Thank you

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Khalid

It sounds like you have the auto-close option eneabled. You need to
disable it.
Right click on your database in EM, choose properties and then check
the options tab to see if the option is enabled.

Regards

John

Sunday, February 26, 2012

Databases show in EM but not in sysdatabases?

I'm managing the back end SQL 2000 instance for a vendors application. The
application allows users to create databases on the fly for testing, etc.
I opened the instance in Enterprise Manager, and noted that the number of
databases had grown to about a dozen (other than the system databases). Hmm,
so being concerned about drive space, etc, I executed a sp_helpdb.
Yikes..only one of the dozen user databases showed in the listing for
sp_helpdb. Checked sysdatabases and sure enough only one user db shows.
But in EM I can open any of the other 11 DB's, open tables from them, view
options, etc etc. So I'm just curious, how can I view them in EM but they
don't show in sysdatabases?
TIA
<*blush*>..Sigh..one of those days. I did a 'Romo'. Time for a brewski.
"Tibor Karaszi" wrote:

> My guess is that you are connecting to different SQL Server instances.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "bill_the_cat" <billthecat@.discussions.microsoft.com> wrote in message
> news:AF04CEDA-BF16-415C-A652-CB7693F2F16D@.microsoft.com...
>

Databases show in EM but not in sysdatabases?

I'm managing the back end SQL 2000 instance for a vendors application. The
application allows users to create databases on the fly for testing, etc.
I opened the instance in Enterprise Manager, and noted that the number of
databases had grown to about a dozen (other than the system databases). Hmm
,
so being concerned about drive space, etc, I executed a sp_helpdb.
Yikes..only one of the dozen user databases showed in the listing for
sp_helpdb. Checked sysdatabases and sure enough only one user db shows.
But in EM I can open any of the other 11 DB's, open tables from them, view
options, etc etc. So I'm just curious, how can I view them in EM but they
don't show in sysdatabases?
TIAMy guess is that you are connecting to different SQL Server instances.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"bill_the_cat" <billthecat@.discussions.microsoft.com> wrote in message
news:AF04CEDA-BF16-415C-A652-CB7693F2F16D@.microsoft.com...
> I'm managing the back end SQL 2000 instance for a vendors application. Th
e
> application allows users to create databases on the fly for testing, etc.
> I opened the instance in Enterprise Manager, and noted that the number of
> databases had grown to about a dozen (other than the system databases). H
mm,
> so being concerned about drive space, etc, I executed a sp_helpdb.
> Yikes..only one of the dozen user databases showed in the listing for
> sp_helpdb. Checked sysdatabases and sure enough only one user db shows.
> But in EM I can open any of the other 11 DB's, open tables from them, view
> options, etc etc. So I'm just curious, how can I view them in EM but they
> don't show in sysdatabases?
> TIA|||<*blush*>..Sigh..one of those days. I did a 'Romo'. Time for a brewski.
"Tibor Karaszi" wrote:

> My guess is that you are connecting to different SQL Server instances.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "bill_the_cat" <billthecat@.discussions.microsoft.com> wrote in message
> news:AF04CEDA-BF16-415C-A652-CB7693F2F16D@.microsoft.com...
>|||Happens to all of us... :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"bill_the_cat" <billthecat@.discussions.microsoft.com> wrote in message
news:DBD746A2-59BE-49C8-90A9-757086DA9412@.microsoft.com...[vbcol=seagreen]
> <*blush*>..Sigh..one of those days. I did a 'Romo'. Time for a brewski.
> "Tibor Karaszi" wrote:
>

Sunday, February 19, 2012

Database/Table Design Question - Object/Event Model

Hi Oran,

If you have a LastEventID on tbl_Folder, why do you need the same
functionality on tbl_EventLog? Aah - going back to your original
question, it looks like you've implemented the "add a LastEventID
column to tbl_Object" approach :)

Maybe I'm just getting pedantic about the naming, but for me a log
table is there to record the where's and when's of events occurring.
Adding history tracking to a log table seems like a pretty unusual
thing to have to do, as the history is already intrinsic to the data.

You still haven't really gone into detail on how these tables are/will
be used... As always, there are a number of ways to produce the
results you are after, the "best" way comes down to balancing your
costs vs requirements equation.

Good luck!
JHi J,

The requirements for the project were to be able determine the status
and location of the Folder (the object) at all times and to track a
history of what has happened to this folder in the past.
The users were really only interested in knowing the current status
and location of a folder. The history requirement was something that
they mentioned would be nice but they didn't really care what it
looked. At the time I had never worked with history or log tables and
I had some deadlines to meet so after consulting a co-worker I put
this tbl_EventLog together (he reccommended the "log" being added on).

There are about 15 event types that can happen to a folder and there
are rules of which events can happen when. After an event occurs the
Location and Status change of the folder. Location is based on where
the event ended up, the "ToDepartmentType_EmployeeID" column. The
status depends on the "EventType" of the event that just occurred.

Looking back at what I did I know I missed a number of things.

1) The history/log should be done differently. Some people
reccommended two tables. One to store the active data and one that
logs the history.
2) There are two levels of statuses. Some statuses stay with a folder
and only get changed by certain events while the level statuses will
be changed by different events.

For example, the event "check out" happens to a folder. The
status is "checked out". The event "check in" will change the status
to "checked in." While it is "checked in" the folder can have the
event "purge" happen to it which
gives the folder the status of "checked in" and "purged."
If the folder now has the "check out" event occur it will be "purged"
and "checked out."

I didn't realize this untill the middle of development and it was
already too late to change the design. Looking back I am trying to
think of the best way to design this.

I hope I made it clearer what the tables are used for.

What is the difference b/n a "log" and "history"?

Would you have three separate tables for current data, log, and
history?

Thanks,

Oran|||You have both mentioned that is a good idea to use a view to hold the
current data.
I assume that in this case the view would Join the Folder with the
LastEvent that occured to the Folder.

I am using SQL Server 2000 sp3.

I am new to views. I have been reading up on them and trying to
determine whether the data in the view gets refreshed when the
underlying tables get new records or do you have to execute the view
everytime you refresh it?

If the latter is true then what advantage does the view have over
exceuting a stored procedure?
The view would have to be refreshed every time I need to know the
status of a folder b/c new events are inserted all the time.

Thanks,
Oran|||Ok, I just tried it myself (should have done this first).

The view did have the most current data in it.

Oran|||I don't know if the previous post worked, but I figured out from
testing the view that the data is refreshed.

Oran|||>I have been reading up on them and trying to determine whether the data in the view gets refreshed when the underlying tables get new records [sic: rows are not records!] or do you have to execute the view every time you refresh it? <<

A VIEW is a virtual table. Whenever you invoke its name, the
optimizer decides if it wants to make it into a materialized table in
physical storage, or if it wants to expand it in the query like an in-
line macro. Either way, its data is always current when you use it.
It is refreshed only if it has to be.

Tuesday, February 14, 2012

Database Tuning Advisor DTA Import Session Results?

Hi,

I have ran the Tuning Advisor (DTA) on a .trc file. Recommendations and reports came back.

I would like to take my exported session results and import that file into a DTA on a different machine with the SQL Server 2005 developer tools installed.

The file is the following Job010704SessionResultsExported.xml

I see how to import a session definition. I do not see how to import 'session results.'

Any ideas oh how to do that?

Thanks,

AIMDBA

DTA does not have such feature. You can file a feature request here.
https://connect.microsoft.com/sqlserver