Tuesday, March 27, 2012
Changing collation on server
On one of my servers diffrent collation is being declered.
I need to change it to SQL_LATIN1_GENERAL_SP1_CI_AS
I used rebuildm program for that. and it failed
what i need to do on the regional settings for allowing this type of
collation?Roy,
what do you mean with rebuildm.exe failed. Did you get any errors or do
you just mean that the collation of your server hasn't changed? By the
way be aware of the fact that rebuildm.exe only changes the collation
of the master, model, msdb and tempdb. Your user databases you have to
convert "manually".
Markus|||How do you change the user databases collation manualy? I have changed the
master db by using rebuildm.exe.
George
"MarkusB" wrote:
> Roy,
> what do you mean with rebuildm.exe failed. Did you get any errors or do
> you just mean that the collation of your server hasn't changed? By the
> way be aware of the fact that rebuildm.exe only changes the collation
> of the master, model, msdb and tempdb. Your user databases you have to
> convert "manually".
> Markus
>sql
Changing collation on server
On one of my servers diffrent collation is being declered.
I need to change it to SQL_LATIN1_GENERAL_SP1_CI_AS
I used rebuildm program for that. and it failed
what i need to do on the regional settings for allowing this type of
collation?Roy,
what do you mean with rebuildm.exe failed. Did you get any errors or do
you just mean that the collation of your server hasn't changed? By the
way be aware of the fact that rebuildm.exe only changes the collation
of the master, model, msdb and tempdb. Your user databases you have to
convert "manually".
Markus|||How do you change the user databases collation manualy? I have changed the
master db by using rebuildm.exe.
George
"MarkusB" wrote:
> Roy,
> what do you mean with rebuildm.exe failed. Did you get any errors or do
> you just mean that the collation of your server hasn't changed? By the
> way be aware of the fact that rebuildm.exe only changes the collation
> of the master, model, msdb and tempdb. Your user databases you have to
> convert "manually".
> Markus
>
Changing collation on server
On one of my servers diffrent collation is being declered.
I need to change it to SQL_LATIN1_GENERAL_SP1_CI_AS
I used rebuildm program for that. and it failed
what i need to do on the regional settings for allowing this type of
collation?
Roy,
what do you mean with rebuildm.exe failed. Did you get any errors or do
you just mean that the collation of your server hasn't changed? By the
way be aware of the fact that rebuildm.exe only changes the collation
of the master, model, msdb and tempdb. Your user databases you have to
convert "manually".
Markus
Thursday, March 22, 2012
Changing a SQL Statement as it's passed to the server.
Wondering if this is possible...
If have a program (a standalone .Exe) that passed the following into our SQL Server.
SELECT l.LabelType, l.PalletLabelID, l.DelSchedID, l.AsnID, d.BasicPartNo, d.LatestPartNo, d.Description, d.PartColour, d.ContainerCode, d.PackFactor FROM Label l INNER JOIN DeliverySchedule d ON l.DelSchedID = d.DelSchedID WHERE l.SupplierID = 1 AND l.WarehouseID = 1 AND l.LabelID = ?
The statement is always the same, the only thing that differs is the LabelID field, which can be any number between 000000 and 999999.
The problem is however is that the statement is wrong! (very wrong), and I was wondering if it was possible to do any of the following:
Create something which could be classed as a "Select Trigger" (that is, I can create a script to determine what values are returned back).
Create something that constantly looks for that sentance been passed and then run my script to return the correct data.
I'm at a loss of ideas on how to achieve what I'm after.
The .Exe can NOT be changed.
Would really appreciate some feedback.
Define "wrong". You could possibly use views to make the data look like the query, if some data is wrong. There are a few things you can do performancewise if it is performance issue.
I don't think there is anything that you can do to capture the statement and change it in stream (unless you wrote your own drivers and used them instead of the OleDb or ODBC drivers, which is probably harder than just rewriting your EXE from scratch.)
>>The .Exe can NOT be changed.<<
Is it that large of a program? Is it a third party thing?
Tuesday, March 20, 2012
Changind date formats
I had a VB program that was using an SQL Server 6.5 DB. Date format
was dd/mm/yyyy. Now the DB was changed to an SQL Server 7 and the date
format is yyyy/mm/dd.
How can I do for changing date formats in the new DB to the old
format?
Im searching for a database level solution, not server level.
thanksOKI (albertooc2003@.hotmail.com) writes:
> I had a VB program that was using an SQL Server 6.5 DB. Date format
> was dd/mm/yyyy. Now the DB was changed to an SQL Server 7 and the date
> format is yyyy/mm/dd.
> How can I do for changing date formats in the new DB to the old
> format?
> Im searching for a database level solution, not server level.
There are not really any date formats in databases in SQL Server. Dates
are stored as binary values, and ideally you program should communicate
with SQL Server using these binary values, and all conversions be
carried out the client, respecting the users regional settings.
If there is a need to control format in SQL Server code, you can use
the convert function, look it up in Books Online under Cast and Convert
for the full details. For instance, if you say:
SELECT convert(char(8), datecol, 112)
You get a datetime value on the form YYYYMMDD. If you say:
SELECT convert(datetime, @.stringval, 121)
@.stringval is interpreted according to format 121, which if memory
serves is YYYY-MM-DD HH:MM:SS.mmm.
If you just say:
SELECT @.dateval = @.stringval
there is an implicit conversion, which is carried out according to the
current datetime and language settings for the connection. There are
only one format i SQL7 that is always interpreted in the same way and
that is YYYYMMDD.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp