Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Wednesday, March 28, 2012

How can I combine different rows?

Hi!

I have a table looking like

(username) (account number) (start date) (end date) (product)

wich I can have up to 4 lines for the same client.

I wist to transfert those lines into a new table looking like

(username) (account number) (start date 1) (end date 1) (product 1)
(start date 2) (end date 2) ... (product 4)

How (in SQL) I could do it?>I have a table looking like ..

Please post DDL instead of your personal narrative. If you had done
the talbe properly, i mgiht look like this:

CREATE TABLE AccountHistory
(acct_nbr INTEGER NOT NULL,
product_nbr INTEGER NOT NULL,
product_cnt INTEGER DEFAULT 1 NOT NULL
CHECK(product_cnt BETWEEEN ! AND 4),
PRIMARY KEY (acct_nbr, product_nbr, product_cnt),
user_name VARCHAR(25) NOT NULL,
start_date DATETIME NOT NULL,
end_date DATETIME NOT NULL,
CHECK (start_date < end_date));

I left out the REFERENCES clause you would need and some other
things.

Quote:

Originally Posted by

Quote:

Originally Posted by

>which I can have up to 4 lines [sic] for the same client. <<


Lines appear on a paper form or an input screen; a table has rows.
You need a constraint to enforce this rule.

Quote:

Originally Posted by

Quote:

Originally Posted by

>I wish to transfer those lines into a new table looking like .. <<


You also failed to give any rules for sorting the repeating groups.
But th real question is why are you doing this at all?? That would
violate First Normal Form (1NF). This is not a good way to write
SQL.

Wednesday, March 21, 2012

How can I access SQL server from SCO Unix?

We are running SCO Unix 5.0.5. We need a command line sql client that can connect to a MS SQL server running on a windows server. Can someone point me in the right direction? I don't want to write a sql client. I just want a command line sql client binary that is ready to work.

I want to do something like this in a unix shell script:

# sql -s 10.1.2.3 -u username -p password -f sqlcommandsinafile.txt -o sqlresults.txt

Any help would be appreciated....

I am not aware of such a cmd line tool on unix. To achieve what you want, you would need to get a hold of a 3rd party unix ODBC driver for SQL server. There is an odbcsql sample that ships with MDAC SDK, you can download the sample and port it to run on Unix.

Hope this helps.

sql

How can I access SQL server from SCO Unix?

We are running SCO Unix 5.0.5. We need a command line sql client that can connect to a MS SQL server running on a windows server. Can someone point me in the right direction? I don't want to write a sql client. I just want a command line sql client binary that is ready to work.

I want to do something like this in a unix shell script:

# sql -s 10.1.2.3 -u username -p password -f sqlcommandsinafile.txt -o sqlresults.txt

Any help would be appreciated....

I am not aware of such a cmd line tool on unix. To achieve what you want, you would need to get a hold of a 3rd party unix ODBC driver for SQL server. There is an odbcsql sample that ships with MDAC SDK, you can download the sample and port it to run on Unix.

Hope this helps.

Monday, March 19, 2012

How can client applications know if a table has been changed by another user?

Is there a mechanism in SQL Server 2000 for notifying client apps in a
multiuser setting when a change has occurred in a table (notification
event).
And/Or, is there a way a client application can 'ask' if a table has
changed?
Thanks,
WykDo you want to know whether that table design is changed or records are
added?
Madhivanan|||In both the cases you have to create your own extensions
to handle the requirement.
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Madhivanan" <madhivanan2001@.gmail.com> wrote in message
news:1109581918.952377.73540@.z14g2000cwz.googlegroups.com...
> Do you want to know whether that table design is changed or records are
> added?
> Madhivanan
>|||It seems like you are describing an optimistic locking strategy. SQL
Server provides a ROWVERSION datatype (also called TIMESTAMP) to track
changes to a row. The client retrieves the data, including timestamp
and then, immediately before saving a change or performing other
actions, the retrieved timestamp is compared to the current one in the
table to determine if the data has changed.
David Portas
SQL Server MVP
--|||> ...The client retrieves the data, including timestamp
> and then, immediately before saving a change or performing other
> actions, the retrieved timestamp is compared to the current one in the
> table to determine if the data has changed.
Or, in the UPDATE, you include the buffered rowversion value in the WHERE cl
ause (with the primary
key value). If the update modifies zero rows, you know that either the row w
as deleted or it was
updated.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1109586059.793247.265620@.f14g2000cwb.googlegroups.com...
> It seems like you are describing an optimistic locking strategy. SQL
> Server provides a ROWVERSION datatype (also called TIMESTAMP) to track
> changes to a row. The client retrieves the data, including timestamp
> and then, immediately before saving a change or performing other
> actions, the retrieved timestamp is compared to the current one in the
> table to determine if the data has changed.
> --
> David Portas
> SQL Server MVP
> --
>|||LOL. First time I noticed your signature, Joe, I thought that SQLNS referred
to the SQL-NS API with
which you can re-use dialogs from EM in your client app. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe Webb" <joew@.webbtechsolutions.com> wrote in message
news:uT5aNdaHFHA.3108@.tk2msftngp13.phx.gbl...
> If you're asking about a way in which a client application can be notified
of new or even updated
> records on the server, then you may want to check out Notification Service
s. The provided Realtor
> sample provides a simple example.
>
> HTH...
> Joe Webb
> SQL Server MVP
> ~~~
> Get up to speed quickly with SQLNS
> http://www.amazon.com/exec/obidos/t...il/-/0972688811
>
>
> Tibor Karaszi wrote:

How can client applications know if a table has been changed

If you're asking about a way in which a client application can be
notified of new or even updated records on the server, then you may want
to check out Notification Services. The provided Realtor sample provides
a simple example.
HTH...
Joe Webb
SQL Server MVP
~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/t...il/-/0972688811
Tibor Karaszi wrote:
>
> Or, in the UPDATE, you include the buffered rowversion value in the WHERE
clause (with the primary
> key value). If the update modifies zero rows, you know that either the row
was deleted or it was
> updated.
>LOL!!! :)
HTH...
Joe Webb
SQL Server MVP
~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/t...il/-/0972688811
Tibor Karaszi wrote:
> LOL. First time I noticed your signature, Joe, I thought that SQLNS referr
ed to the SQL-NS API with
> which you can re-use dialogs from EM in your client app. :-)
>

how can check the time?

I have a stored procedure and I want to run a command based on time so if the time is after 8pm the charge the client US$ 10 otherwise US$ 8

Code Snippet


charge = case when datepart(hour, getdate())>=20 then 10 else 8 end

|||

That covers it up to midnight. Most likely you will also want to continue past midnight up to some early morning time.

If so, then something like this: (building on phdiwakar's suggestion) to charge $10 between 8 PM and 6 AM


Code Snippet

Charge = CASE
WHEN ( datepart( hour, getdate()) >= 20
OR datepart( hour, getdate()) <= 5
) THEN 10
ELSE 8
END

Monday, March 12, 2012

How can a client application get serial number of SQL server installation

I want to write an application, which will be validated by serial number.
This serial number has to be dependent on serial number, which
is used during SQL Server installation.
In other words - licence key for my client application has to be dependent
on server.
How can my client application get server validation key or another server
specific information (such harddisk serial number of the server, network
adapter card serial number etc)?
Message posted via http://www.sqlmonster.com
You can get the serial number of the SQL Server installation from the
registry key:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\80\Registration\CD_KEY.
Jacco Schalkwijk
SQL Server MVP
"Jaroslav Sedlak via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:ead3ca55b3b1403b9d1d532fad4eb192@.SQLMonster.c om...
>I want to write an application, which will be validated by serial number.
> This serial number has to be dependent on serial number, which
> is used during SQL Server installation.
> In other words - licence key for my client application has to be dependent
> on server.
> How can my client application get server validation key or another server
> specific information (such harddisk serial number of the server, network
> adapter card serial number etc)?
> --
> Message posted via http://www.sqlmonster.com
|||Yes, you are right. But this doesn't solve my problem. This registry key
can be read only by an application, which runs on the server.
I want to get licence key of SQL server in application which runs not on
the machine server but on the client machine.
Message posted via http://www.sqlmonster.com
|||You can access the registry from within SQL Server with the undocumented
extended procedure xp_regread. See
http://www.databasejournal.com/featu...le.php/1441251
for more details.
Jacco Schalkwijk
SQL Server MVP
"Jaroslav Sedlak via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:a921286e80de46b891c501f50382388a@.SQLMonster.c om...
> Yes, you are right. But this doesn't solve my problem. This registry key
> can be read only by an application, which runs on the server.
> I want to get licence key of SQL server in application which runs not on
> the machine server but on the client machine.
> --
> Message posted via http://www.sqlmonster.com

How can a client application get serial number of SQL server installation

I want to write an application, which will be validated by serial number.
This serial number has to be dependent on serial number, which
is used during SQL Server installation.
In other words - licence key for my client application has to be dependent
on server.
How can my client application get server validation key or another server
specific information (such harddisk serial number of the server, network
adapter card serial number etc)?
Message posted via http://www.droptable.comYou can get the serial number of the SQL Server installation from the
registry key:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\80\Registration\CD_KEY.
Jacco Schalkwijk
SQL Server MVP
"Jaroslav Sedlak via droptable.com" <forum@.droptable.com> wrote in message
news:ead3ca55b3b1403b9d1d532fad4eb192@.SQ
droptable.com...
>I want to write an application, which will be validated by serial number.
> This serial number has to be dependent on serial number, which
> is used during SQL Server installation.
> In other words - licence key for my client application has to be dependent
> on server.
> How can my client application get server validation key or another server
> specific information (such harddisk serial number of the server, network
> adapter card serial number etc)?
> --
> Message posted via http://www.droptable.com|||Yes, you are right. But this doesn't solve my problem. This registry key
can be read only by an application, which runs on the server.
I want to get licence key of SQL server in application which runs not on
the machine server but on the client machine.
Message posted via http://www.droptable.com|||You can access the registry from within SQL Server with the undocumented
extended procedure xp_regread. See
http://www.databasejournal.com/feat...cle.php/1441251
for more details.
Jacco Schalkwijk
SQL Server MVP
"Jaroslav Sedlak via droptable.com" <forum@.droptable.com> wrote in message
news:a921286e80de46b891c501f50382388a@.SQ
droptable.com...
> Yes, you are right. But this doesn't solve my problem. This registry key
> can be read only by an application, which runs on the server.
> I want to get licence key of SQL server in application which runs not on
> the machine server but on the client machine.
> --
> Message posted via http://www.droptable.com

How can a client application get serial number of SQL server installation

I want to write an application, which will be validated by serial number.
This serial number has to be dependent on serial number, which
is used during SQL Server installation.
In other words - licence key for my client application has to be dependent
on server.
How can my client application get server validation key or another server
specific information (such harddisk serial number of the server, network
adapter card serial number etc)?
--
Message posted via http://www.sqlmonster.comYou can get the serial number of the SQL Server installation from the
registry key:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\80\Registration\CD_KEY.
--
Jacco Schalkwijk
SQL Server MVP
"Jaroslav Sedlak via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:ead3ca55b3b1403b9d1d532fad4eb192@.SQLMonster.com...
>I want to write an application, which will be validated by serial number.
> This serial number has to be dependent on serial number, which
> is used during SQL Server installation.
> In other words - licence key for my client application has to be dependent
> on server.
> How can my client application get server validation key or another server
> specific information (such harddisk serial number of the server, network
> adapter card serial number etc)?
> --
> Message posted via http://www.sqlmonster.com|||Yes, you are right. But this doesn't solve my problem. This registry key
can be read only by an application, which runs on the server.
I want to get licence key of SQL server in application which runs not on
the machine server but on the client machine.
--
Message posted via http://www.sqlmonster.com|||You can access the registry from within SQL Server with the undocumented
extended procedure xp_regread. See
http://www.databasejournal.com/features/mssql/article.php/1441251
for more details.
--
Jacco Schalkwijk
SQL Server MVP
"Jaroslav Sedlak via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:a921286e80de46b891c501f50382388a@.SQLMonster.com...
> Yes, you are right. But this doesn't solve my problem. This registry key
> can be read only by an application, which runs on the server.
> I want to get licence key of SQL server in application which runs not on
> the machine server but on the client machine.
> --
> Message posted via http://www.sqlmonster.com

Wednesday, March 7, 2012

how 2 install client tools for SQl Server

In Server Explorer of VS .NET 2003, I tried to generate SQL script of the dbo.Portal (ibs)
but got
"To use this feature, you must install the client tols for SQL Server"

When I searched for Help, I've got
"1.Insert the MS SQL Server 2000 compact disc in your CD-ROM drive"

I installed and use MSDE and cannot recall the use of any CD for installation.

1)
Does it mean that I cannot install client tools from MSDE installation?

If not...

2)
I have installation of MS SQL Server200 Enterprise that cannot be installed on Windows Xp Professional that I use. Can I still install "client tools" from Enterprise Ed. for MSDEMSDE !== SQL Server

1. you get the client tools with SQL Server, not with MSDE, which is just the data engine.
2. you should be fine to install the SQL Ent client tools on XP - but it won't let you install the server.|||Thanx, Atrax,
I aslo found in
http://www.microsoft.com/sql/msde/howtobuy/msdeuse.asp


You can only use SQL Server tools and services in conjunction with MSDE if you acquired MSDE through SQL Server 2000 (Developer Edition, Standard Edition, or Enterprise Edition), and if you are using MSDE in conjunction with a properly licensed copy of SQL Server 2000.

I am now in doubt where from I have installed MSDE, since I vaguely recall that I have MSDE installables in various places:
- free downloads
- various editions of SQL Server from CDs,
- MS Office and VS .NET installations
I remember I reinstalled them in various combinations on various PCs.

How can I determine whether MSDE is from Developer, Standard or Enterprise Ed.s or from free download?
Or it is not important?