Quantcast
Channel: SQL General — mibuso.com
Viewing all 116 articles
Browse latest View live

Page size vs. record size

$
0
0
Hello.

In NAV the max record size is 8000 bytes and the size of a page is 8KB on sql server.
Can I conclude then that if sql places a page lock that then only one record will be locked?

Thanks.

Noob question about a SQL Query

$
0
0
Hi all.

I think this is a fairly basic query but I mainly concern myself with general admin (backups etc) from the management studio.

Basically, I want to select a load of items from the Sales Price Table which are Customer Prices and have Expired. When I find them I want to set a custom field (Blocked Pending Price Check) on the corresponding item on the Item Table

My script to select the items in question is simple enough (and gives the desired result):

select [Item No_] from [MyCompany$Sales Price]
where [Ending Date] < '04/02/2015 00:00:00.000' and [Sales Type] = 0
and [Sales Code] = 'CustomerA'

This gives a list of all items that I want to set the flag on but I'm guessing I need to assign the above results to some sort of variable (let's call it 'A') such that I can do something along the lines of:

update [MyCompany$Item]
set [Blocked Pending Price Check] = 1 where No_ = A

Any help appreciated! [-o<

NAV 4.03 build 6 compatibility with Windows 8

$
0
0
I have a quick question:
Does anyone know if NAV 4.03 build6 is compatible with Windows 8?

What impact does my C/AL have on SQL?

$
0
0
Source: my blog.

I wrote a little something about the FIND statements and such ... could be nice for reading on a Sunday evening :wink: . For the better edited version, go to my blog (the tables that I used are a pain in the ass here :().

This is a very challenging blogpost in my opinion. I see many stories going around on what would be the best way to use the new FIND-instructions, what C/AL to write in what case. I have my own thoughts on this which I would like to share. I don't want to say the following is the best way to go, let's just say it's a good way to go .

First question (and I think the most important question that is on people's mind), how to use the FIND statements. This is not easy, because using the FIND statement really depends on the type of loop you're using.

First of all the basics. I think the table from stryk explains it very well:
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
Customer.FIND('-');

 SELECT *,DATALENGTH("Picture") 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US')) 
ORDER BY "No_"
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US');
Customer.FINDFIRST;

 SELECT TOP 1 *,DATALENGTH("Picture") 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US')) 
ORDER BY "No_"
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
Customer.FIND('+');

 SELECT *,DATALENGTH("Picture") 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US')) 
ORDER BY "No_" DESC
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
Customer.FINDLAST;

 SELECT TOP 1 *,DATALENGTH("Picture") 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US')) 
ORDER BY "No_" DESC
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
Customer.FINDSET;

 SELECT TOP 500 *,
DATALENGTH("Picture") 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US')) 
ORDER BY "No_"
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
Customer.FINDSET(TRUE);

 SET TRANSACTION ISOLATION LEVEL 
SERIALIZABLE 
SELECT *,DATALENGTH("Picture") 
FROM "dbo"."Cronus$Customer" 
WITH (UPDLOCK) 
WHERE (("Country Code"='US')) 
ORDER BY "No_"
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
IF Customer.ISEMPTY THEN;

 SELECT TOP 1 NULL 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US'))
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
IF Customer.COUNT <> 0 THEN;

 SELECT COUNT(*) 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US'))
-----------------------------------------------------
Customer.SETRANGE("Country Code", 'US'); 
IF Customer.COUNTAPPROX <> 0 THEN;

 SET SHOWPLAN_ALL ON 
SELECT * 
FROM "dbo"."Cronus$Customer" 
WITH (READUNCOMMITTED) 
WHERE (("Country Code"='US'))
----------------------------------------------------- 
GLEntry.LOCKTABLE; 
GLEntry.FIND('+');

 SET TRANSACTION ISOLATION LEVEL
SERIALIZABLE 
SELECT * 
FROM "dbo"."Cronus$G_L Entry" 
WITH (UPDLOCK) 
ORDER BY "Entry No_" DESC
----------------------------------------------------- 
GLEntry.LOCKTABLE; 
GLEntry.FINDLAST;

 SET TRANSACTION ISOLATION LEVEL SERIALIZABLE 
SELECT TOP 1 * 
FROM "dbo"."Cronus$G_L Entry" 
WITH (UPDLOCK) 
ORDER BY "Entry No_" DESC

A ground rule might be: try to fetch as less data as needed - but all data you need - in one server call. E.g. Don't fetch all records if you're not going to loop those records / Don't fetch data if you just want to know if a record is present for that range or not, ... .

The table above is nice, but it still doesn't make me think about the things I have to take in count when writing code. Let me try to help you with this by asking a few basic questions:

WHEN NOT LOOPING DATA

Am I going to change data?
Suppose you write this code:
recCust.GET('10000'); 
recCust.VALIDATE(Name, 'Van Terp Kantoorinrichting'); 
recCust.MODIFY(TRUE);

Not really exciting. In fact, I see code like this going around quite often. Well, the problem with this is that you do an extra server call, because you didn't apply that you wanted to change data. In fact, you'll see this in the client monitor:
----------------------------------------------------- 
recCust.GET('10000');
 SELECT *,DATALENGTH("Picture") 
FROM "CRONUS BELGIË NV$Customer"
WITH (READUNCOMMITTED) 
WHERE "No_"='10000' 
 Read the data without setting a lock (you didn't specify this)
-----------------------------------------------------
recCust.VALIDATE(...); 
recCust.MODIFY(TRUE);
 SELECT *,DATALENGTH("Picture") FROM "CRONUS BELGIË NV$Customer" WITH (UPDLOCK, REPEATABLEREAD) WHERE "No_"='10000' 

UPDATE "CRONUS BELGIË NV$Customer" WITH (REPEATABLEREAD) SET ...
 Read the data again and place a lock.

Update the fields.
-----------------------------------------------------

Two times the SELECT is overkill, and must be avoided. And avoiding it is simple. Specifying that you want to change the data can be done by "LOCKTABLE". This makes our small piece of code like:
recCust.LOCKTABLE; 
recCust.GET('10000'); 
recCust.VALIDATE(Name, 'Van Terp Kantoorinrichting'); 
recCust.MODIFY(TRUE);
To make the comparison complete, here is what happens behind the scenes:
----------------------------------------------------- 
recCust.LOCKTABLE;
recCust.GET('10000');
 SELECT *,DATALENGTH("Picture") FROM "CRONUS BELGIË NV$Customer" WITH (UPDLOCK, REPEATABLEREAD) WHERE "No_"='10000' 
 Read the data with setting a lock
----------------------------------------------------- 
recCust.VALIDATE(...); 
recCust.MODIFY(TRUE);
 UPDATE "CRONUS BELGIË NV$Customer" WITH (REPEATABLEREAD) SET ...
-----------------------------------------------------

This being said, take a look at following example:
IF ICHandledInboxTransaction.FIND('-') THEN BEGIN 
  ICHandledInboxTransaction.LOCKTABLE; 
  ICHandledInboxTransaction.Status := ICHandledInboxTransaction.Status::Posted; 
  ICHandledInboxTransaction.MODIFY; 
END;

This is code from default NAV (earlier version) which could be replaced by (to not change the behaviour on Native):
IF RECORDLEVELLOCKING THEN 
  ICHandledInboxTransaction.LOCKTABLE; 
IF ICHandledInboxTransaction.FINDFIRST THEN BEGIN 
  ICHandledInboxTransaction.LOCKTABLE; 
  ICHandledInboxTransaction.Status := ICHandledInboxTransaction.Status::Posted; 
  ICHandledInboxTransaction.MODIFY; 
END;

The statement "RECORDLEVELLOCKING" is the way for checking in code whether you're working on SQL Server (TRUE) or Native (FALSE). Furthermore, I added these two lines of code because it's necessary to lock before we read (to send the UPDLOCK in SQL).

Does a record exist?
There are two (good) ways to check whether a record is present for a certain range:

Using FINDFIRST: Use this statement when you need the data of the first record, and the first record only.
Using ISEMPTY: this is a somewhat forgotten statement, but it's lighter then the FINDFIRST. If you only want to check if a record exists in the filtered range, but you don't need any value of a field of any of the records, use this statement.
See table above for what SQL Statement it produces (TOP 1 * or TOP 1 NULL).

For example:
IF SalesLine.FIND('-') THEN 
  Cust.CheckBlockedCustOnDocs(Cust,"Document Type",TRUE,TRUE);
Could be replaced by
IF NOT SalesLine.ISEMPTY THEN 
  Cust.CheckBlockedCustOnDocs(Cust,"Document Type",TRUE,TRUE);
WHEN LOOPING DATA

That wasn't that exciting, was it? But what if we want to loop data. That's a whole different story .

First thing that I have to state is that NAV uses cursors to simulate native behaviour. The new FIND statements (from 4.0) are the first step to go around this native behaviour.

Looping without changing data

In Stryk's tabel above, you can see the difference on SQL level between FIND('-'), FINDFIRST and FINDSET. I'll try to make the comparison of what happens on SQL Server:
-----------------------------------------------------
IF recCust.FINDFIRST THEN 
REPEAT 
UNTIL recCust.NEXT = 0;

SELECT TOP 1 *,DATALENGTH("Picture") FROM "CRONUS BELGIË NV$Customer" WITH (READUNCOMMITTED) ORDER BY "No_" 

SELECT *,DATALENGTH("Picture") FROM "CRONUS BELGIË NV$Customer" WITH (READUNCOMMITTED) WHERE "No_">'01121212' ORDER BY "No_" 

FETCH 5 
FETCH 20 
FETCH 40 
FETCH 40
-----------------------------------------------------
IF recCust.FINDSET THEN 
REPEAT 
UNTIL recCust.NEXT = 0;

SELECT TOP 501 *,DATALENGTH("Picture") FROM "CRONUS BELGIË NV$Customer" WITH (READUNCOMMITTED) ORDER BY "No_" 
-----------------------------------------------------
IF recCust.FIND('-') THEN 
REPEAT 
UNTIL recCust.NEXT = 0;

SELECT *,DATALENGTH("Picture") FROM "CRONUS BELGIË NV$Customer" WITH (READUNCOMMITTED) ORDER BY "No_" 

FETCH 5 
FETCH 20 
FETCH 40 
FETCH 40
-----------------------------------------------------
What do we learn from this:

The best way to go is using the FINDSET. Why? It's fetching a SET of records and will be working with this set all the way. You see that there is no cursor activity (no FETCH statements). If you read further, you'll see that this is not always the case!
FINDFIRST is worse then FIND('-') when looping records because of the extra call (TOP 1 *). NAV does not expect a loop after a FINDFIRST. If it sees that you are looping, it's doing a new SELECT * (same as FIND('-') statement) to be ready for the loop and working with cursors to loop through the data (therefore the FETCH statements). Therefore, please do not just replace FIND('-') with FINDFIRST.
Never blindly replace FIND('-') by FINDFIRST. Think of what you're doing.
Now, what about the number of records? Does that count?

Well, NAV behaves like this: if the set is bigger then 500 records (or the size you specified as "Record Set" value in the "Alter Database" window), it will not use the recordset, but is going to "cursor" it's way through the rest of the loop, like "old school". I'll try to show it using tho examples. In both of them, the code runs 2840 times through the loop (or in other words, the messages shows "2840").
-----------------------------------------------------
i := 0; 
IF recGL.FIND('-') THEN 
REPEAT 
  i := i + 1; 
UNTIL recGL.NEXT = 0; 
MESSAGE('%1',i);


SELECT * FROM "CRONUS BELGIË NV$G_L Entry" WITH (READUNCOMMITTED) ORDER BY "Entry No_" 

FETCH 5 
FETCH 20 
FETCH 60 
FETCH 60 
FETCH 60 

. 
. 
. 

A total of 2845 "FETCHes"
----------------------------------------------------- 
i := 0; 
IF recGL.FINDSET THEN 
REPEAT 
  i := i + 1; 
UNTIL recGL.NEXT = 0; 
MESSAGE('%1',i);

SELECT TOP 501 * FROM "CRONUS BELGIË NV$G_L Entry" WITH (READUNCOMMITTED) ORDER BY "Entry No_" 

SELECT * FROM "CRONUS BELGIË NV$G_L Entry" WITH (READUNCOMMITTED) WHERE "Entry No_">501 ORDER BY "Entry No_" 

FETCH 5 
FETCH 20 
FETCH 60 
FETCH 60 
FETCH 60 
. 
. 
. 

A total of 2365 "FETCHes"
-----------------------------------------------------
In case of the FINDSET: A first impression shows you the when the resultset is bigger than 500 records, it just throws an extra database call without the "TOP 500" and is going to cursor it's way through the records. When you examine deeper, you conclude that it's actually looping through the recordset of 500 records, and after that, NAV does not call the next 500 records, but just trows a "SELECT *" and is going to cursor it's way through the rest of the records.

That's why with FINDSET, we have about 500 FETCHes less than FIND('-'). BUT, we have an extra database call, which is quite "heavy" (a "SELECT *" is heavier than a "FETCH 60").

It's hard to discuss what's best. Further benchmarking should point that out. I would bet my money on using FINDSET in all cases. Why?

You avoid about 10 times a FETCH x call
A "SELECT TOP 500" as extra database call doesn't seem that heavy for me.
If anyone is interested in doing a thorough investigation on this ... Please count me in or let me know the results.

What do we learn from this:

Using FINDSET in front of every loop, is a pretty sure bet.
Using FINDSET only gets the first 500 records as a set, but is going to cursor it's way through the rest of the records like FIND('-').
Looping with changing data

The same rules apply like above, only see if you're locking the data before you're reading it. You can do this by either using LOCKTABLE, like:
recGL.LOCKTABLE; 
IF recGL.FINDSET THEN 
REPEAT 
... 
UNTIL recGL.NEXT = 0;

Or, if using the FINDSET statement, you can use its parameter like:
IF recGL.FINDSET(TRUE) THEN 
REPEAT 
... 
UNTIL recGL.NEXT = 0;

There is also an option FINDSET(TRUE, TRUE). Only use this if you are going to modify any field value within the current key. Now, I really don't recommend to use this. You have to be aware for the "NEXT FROM HELL" (like Hynek likes to call it).

The "Next from hell" can happen when you filter on a value, and in a loop, you're changing that value. The loop jumps to places that are hard to predict. Also, when you change a key value in a loop (even without modify), a "NEXT" can give unexpected results. Try to avoid these situations by just declaring a new variable, and modify in that variable. For example, this is looking for trouble:
recCust.SETRANGE("Country/Region Code", 'BE'); 
IF recCust.FINDSET(TRUE) THEN 
REPEAT 
  recCust.VALIDATE("Country/Region Code", 'US'); 
  recCust.MODIFY; 
UNTIL recCust.NEXT = 0;

You're modifying the Country Code while you're filtered on that field. Try to use a seperate record variable, and leave your looping variable intact, like:
recCust.SETRANGE("Country/Region Code", 'BE'); 
IF recCust.FINDSET(TRUE) THEN 
REPEAT 
  recCust2 := recCust; 
  recCust2.VALIDATE("Country/Region Code", 'US'); 
  recCust2.MODIFY; 
UNTIL recCust.NEXT = 0;

Conclusion

When I started writing this article, I didn't expect that it was so hard to put this subject into words. I hope the above is clear to you, but to be sure, I just wanted to give you an overview of the things mentioned above.

Not looping data
Modifying data
Use LOCKTABLE with GET or FINDFIRST
Not modifying data (usually to check if a record exists or not)
Use FINDFIRST if you need the data of the record further down the road
Use ISEMPTY if you do not need the values of the keys
Looping data
Not modifying data
Use loop like: IF FINDSET THEN REPEAT UNTIL NEXT=0;
Modifying data: see that you lock the records that you read.
Use loop like: IF FINDSET(TRUE) THEN REPEAT UNTIL NEXT=0;
Mind the "NEXT FROM HELL" !
So, always think what the code is doing, then make up your mind what you will need for most optimal performance on SQL Server.

Writing this article, I used the SQL Profiler and Client monitor to monitor what my code is doing. I noticed very few people know what this client monitor can do, so who knows, there might be an upcoming blog about monitoring your code .

Any comments are appreciated!

Different Collation per. Company – anyone tried it?

$
0
0
(NAV 2009 Classic.)
We are having issues with a database that is going to be used from several countries around the globe – both Europe and Asia. Each country has their own Terminal Server set in local non-unicode codepage. Each company is only used in one country, but we are unable to store local chars unless the collation of the database match the language of the country.

We are therefore considering batch job that changes the collation of all Text fields in the tables belonging to each company. (we are also considering Code fields, but we don’t think it will be necessary) We foresee a few issues , but nothing serious:
    Not handling shared tables Might cause issues if we access the SQL tables directly for JOINs or replication etc. We need to run the batch job each time a FOB is imported. Does not allow object names or fields names to be localized

Has anyone tried this approach or have any objections or recommendation about it?

Who generates SQL query in NAV?

$
0
0
Hello all,

Maybe the subject is little bit wrong but here is what I would like to know.

I have development and production environment that are pretty much similar. I'm running navision 4 sp3 and with client monitor check in one specific report. For the one specific command (that is repeated for several times) on development I see the same query every time, select top 1 null. But, on production, first three times it executes select top 500 *, and the rest is select top 1 null.

Based on what Navision could decide to issue different commands for the same navision command, even in the same running (production)?

execute an SQL procedure from excel

$
0
0
Hi experts!!

Does anyone know how to execute an SQL procedure from excel?

I have procedures that create tables in SQL Server. These tables are used in views then I see in excel.
I need to implement these procedures to update the data in Excel.

Is it possible?

thanks!!

List of Granule to run a web service?

$
0
0
Hi all,
I m in a problem to run a web service in NAV 2009, all time i run the web service it gives me the error that
"You do not have permission to run the 'Microsoft Dynamics NAV Server' System. Contact your system administrator to have your permissions changed"

I checked the license of my user it has Advancement Management License, but it does not have granule 9100 and Granule 11123310 SC.
Is these granule are important to run the web service.
Please reply asap...

using ADO and SQL queries longer than 1024 char.

$
0
0
Hello,

Has anyone got an idea how to execute sql queries longer than 1024 characters using ADO in Navision.

The query I want to executed is generated dynamically during run-time, so stored procedures do not help here.

What I did: I output the generated sql to text file and then used special my written automation server (SQLFileExecuterX) which executes text files as sql queries...

But I thought, maybe somehow it is possible to do that without using SQLFileExecuterX, but using such features like BIGTEXT or Stream, or at least some standard software which goes together with navision/ado/windows...?

huh?

AlwaysOn function in SQL 2014 (an 2012)

$
0
0
Hi folk,
do you know the "always on" functionality in SQL Server using a Dynamics Nav installation?

This would be usefull for the same company with multiples instances of SQL Server, having all databases accessible together. Is there a recommendation or any white sheet about Alwayson?
If not, have any of you did a setup with a multicompany with diferent location between them?

thanks in advance
Carles

Lock request time out period exceeded error

$
0
0
Hi,

I'm trying to create NAV tenant (NAV 2015) using PowerShell in Windows Server 2012 environment.

When I execute HowTo-MoveCompanyToTenant script it gives following error;
Invoke-Sqlcmd : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
At D:\Sana Remote Installation Files\NAVTenantInstallation\AddCompanyTenant.ps1:300 char:9
+ Invoke-Sqlcmd -Database $FromDatabase -InputFile "G:\HowTo-MoveCompanyTo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
+ FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

And windows event log says;
Lock request time out period exceeded.

In the PowerShell script, I have done following modification in-order to read HowTo-MoveCompanyToTenant.sql script.
......
Write-Verbose "Moving company ""$company"" from server/database (Tenant) $DatabaseServer/$FromDatabase ($OldTenantName) to new database/tenant $ToDatabase/$NewTenantName"
Write-Verbose "Creating company ""$company"""
New-NAVCompany -ServerInstance $ServerInstance -Tenant $NewTenantName -CompanyName $company

#Move the data from the old to the new company
Write-Verbose "Moving data"

$VariableArray = "Company=$company","FromDatabase=$FromDatabase","ToDatabase=$ToDatabase"
#$sqlFile = Join-Path $PSScriptRoot 'HowTo-MoveCompanyToTenant.sql'
#Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $FromDatabase -InputFile $sqlFile -Variable $VariableArray -ConnectionTimeout 0

Invoke-Sqlcmd -Database $FromDatabase -InputFile "G:\HowTo-MoveCompanyToTenant.sql" -QueryTimeout 0 -ServerInstance $DBServerWithInstance -Variable $VariableArray

if ($RemoveCompanyWhenMoved)
{
Write-Verbose "Dropping old company"
Remove-NAVCompany -ServerInstance $ServerInstance -Tenant $OldTenantName -CompanyName $company -Force
}
........

Can anyone help me to sort out this issue.

Best regards,
Yasith

Modify a boolean field in NAV database by TSQL

$
0
0
Hi guys,

If i change a Boolean field that i have added to the "Sales Invoice Header" with a SQL Script, can something wrong happen ??

Thanks

ADO jumps back to default

$
0
0
Can someone please tell me how to force the ADO connection to stay on the instance?

Setup:
Server S004 is running 2 SQL servers. Vanilla SQL 2008, and SQL 2012 as instance SQL2012.
When connecting to the databases you point to s004 if you want bases on SQL2008, and s004\SQL2012 if you want bases on the SQL2012 instance. Connections are fine, service run without any problem; everybody is happy!

Well, everybody except me. On a different machine/setup I regularly need to get data on databases on s004\SQL2012 into a 2009R2 database. So instead of having to copy/paste I decided to make a little code snippet that would connect to the databases, and grab the data for me. But for some reason beyond me, the connection refuses to stick on the instance and will instead insist on going to the default installation.

For instance shoting off "Provider=SQLOLEDB;Data Source=S004\SQL2012,1433;Initial Catalog=LM;Trusted_Connection=Yes" will result in an error saying "Cannot open database LM requested by the login"
I am sysadmin and dbowner on all databases, and can access them all with Studio Management, so access isn't an issue

I tried replacing "Initial catalog" with Database, same error. I tried username/pw instead of Trusted_Connection, I tried "Integrated Security"; all with the same errormessage.
I then tried connecting to Master just to make sure I wasn't losing my marbles. That worked perfectly, so the connection happens :D
Cycling through the various thoughts, I at one point pointed to a database that exists on the default s004, and all of a sudden there was life on the other side :shock:

So now my question is, why does my connection go to the default instance on s004, and how do I stop it? The database i want is on the named instance, and I want my connction to stay there :x

Any help/hints are welcome.

How to change records in MS Dynamics customer table?

$
0
0
Hi, how can I change all records in column "City" / Name1 with Name 2 in table 18 Customer in Navision 4.3?

Different Collation on SQL Server and NAV 2015 DB

$
0
0
Hello.

We have a SQL 2014 Standard Server installed with a NAV 2015 database installed on that.
The SQL 2014 Standard Server has the following SQL collation: SQL_Latin1_General_CP1_CI_AS
The NAV 2015 database has the collation: Latin1_General_100_CS_AS

To set the SQL 2014 Server to the same collation as the NAV database, simple way is the recreate the SQL Default databases and thereby set the new collation as same as NAV database.

Question: uses NAV only the own NAV database? Or uses NAV also Default databases from SQL (e.g. temp) to operate?

Thank you for your assistance / your best practise for that.

Best regards,
Lars

SQL Server 2014 web version is not working with Nav 2015?

$
0
0
Does SQL Server 2014 web edition work with Microsoft Dynamics Nav 2015?

I read the Microsoft Dynamics NAV 2015 requirements but not sure.


Thanks

Unable to rename company in Navision.

$
0
0

Microsoft Dynamics NAV
The following SQL Server error(s) occurred while accessing the G/L Entry table:

15336,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server]Object '"Playground"."dbo"."CompanyName$G_L Entry"' cannot be renamed because the object participates in enforced dependencies.

SQL:
{CALL [sp_rename](?, ?, ?)}

OK


I get the above error.

Does this mean someone has set up some constraint directly in SQL.

I am trying to rename "CompanyName" to Playground.

Where do I find my pages and forms in sql?

$
0
0
Hi folks,
I searched a while maybe I not long enough.
I would like to find in the sql database (nav2015), the whereabouts of my pages. I am really new to sql, so I have no idea how to do that. I want to search for a trigger in pages in the c/al code.
A programmer told me it would be possible to access it on the database-level, but I can't find whereabouts. Maybe some one can tell me where in the database to find it.

Or explain me why I seem to be unable to find the pages.
I use a sql management studio 2014.


This is some sqlrequest I got from the internet
:blush:

select 'select distinct ''found in table ' 
 + [TABLE_NAME] + ' column ' 
 + [COLUMN_NAME] + ' '' from ' + [TABLE_NAME] 
 + ' where ' + [COLUMN_NAME] + ' like ''%searchedterm%'' union all ' 
 from [INFORMATION_SCHEMA].
 where [DATA_TYPE] in ('varchar','text')
 order by 1  

... always gives me same 119 records back. I honestly need help.

Thank you so much in advance and if I am wrong here, dear admin please put me in place :). Sorry for my bad english.

Problem with Requery/Update

$
0
0
Hello everyone,
working with a Navision 2009 R2 DB (Classic Client) changing data with a SQL-DB via ADO I'm now facing a Problem:

I put data from a NAV-Table into the SQL DB with AddNew and Update, so far it works. After having written data to the SQL-DB, I have to put a value of 1 to a Status field there. This is the code (I did not find a way to fomat it):


gatADORecordSet.Fields.Item(FORMAT(gTxT_ExportOrderHead_ProcState)).Value := 47;
gatADORecordSet.Update;
gatADORecordSet.Requery(ginRequeryMethod);
gatADORecordSet.Fields.Item(FORMAT(gTxT_ExportOrderHead_ProcState)).Value := 1;
gatADORecordSet.Update;

The value of 47 is being put to gatADORecordSet.Fields.Item(FORMAT(gTxT_ExportOrderHead_ProcState)).Value . Unfortunately the value of 1 is not. I also tried Close and Open instead of Requery, but it had no effect.

Has anyone an idea what I did wrong?

With kind regards.

Snapshot Replication Failure

$
0
0
Hi,

Our snapshot replication just stopped working about a week ago, and I have been trying to get it running ever since.

It seems to fail at the snapshot generation.

I get error messages containing such things as "unable to read column". There are also numerous timeouts on various steps with the notation that they will be restarted.

The process used to complete within about two hours. Now it runs for upwards of 8 hours and then errs out.

I note that all 32 Gb RAM gets used up in the process pretty much, though no out of memory messages are generated.

We are on sql server 2005 on windows server 2003 R2 SP2 Standard x64 Edition.

I don't have the error message right here to copy in, and I don't expect anyone to look at it that deeply.

I am just hoping for some tips and tricks or common experience sharing.

Thanks,

Michael
Viewing all 116 articles
Browse latest View live