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

Report Inventory Value using SQL server

$
0
0
Hi all, I have to do Inventory Value report, using SQL. How to do this? Which tables and filds must to use?

Thank you

What technology to use to exchange basic sales data between server and POS?

$
0
0
Hello all,
I need an advise from our experienced and valuable members, we have a task exchange data between sql servers.
1. From server /MS SQL 2012 standard/to POS database import basic information like customer, item, sales price etc. /no updates on POS/
2. From 4-5 POS databases /MS SQL 2012 express/ to the server database import sales header and line. /no updates on server side/

We are planning to use merge replication for this task. The question is:
- Could MS SQL Replication is proper solution?
- If not, what else would be?

mdf file in SQL 2012

$
0
0
Hello everybody!
I’m working with sql database for couple months. Today I have opened it and see pop-up window: “The header for file 'xxxx.mdf' is not a valid database file header. The FILE SIZE property is incorrect.”

I don’t know what to do next, some ideas?

Thanks in advance!

Create New Table and update table with data from another

$
0
0
Hi
I have created a table in SQL , the table will contain selected columns from the Value Entry table in our NAV database. I do visualization in Tableau , however to do visualization with data containing the Item Charges is a bit tricky and difficult to add to the visualization in Tableau. This is the for me creating a new table and then split the item charges with a CASE or IF statement when I alter the stored procedure in SQL. my new column must contain or I must add 2 to 3 new calculated columns including the columns I have selected from the value entry table to be inserted. the calculated columns will be Sales Support, which will consist of (Promo, Rebate, Storage) , Export Cost which contains 'FOBB' charges which is costs. to give you an understanding of the this is , PROMO REBATE and STORAGE including FOBB is all listed in the Item Charge No column in the Value Entry table within NAV , the sales amount(Actual) will have another column added as Gross Revenue. The sales amount(actual) column contains the value of the item charges. hope you understand my explaination and hope you can assist in this regard

How would I get this to work so that the stored procedure can update my new table containing the splits into the related columns ,

How to automatically import Sales from another Software

$
0
0
Hello community fellas ... I am currently using a Rapidstart services to import sales from another software but now im trying to make an middle software for this regard... I have analyzied tables and columns but i need expert help if possible.

Can some help me in this regard. I need to know which tables do i need to insert in and in what order?

I have tried to insert data directly to SalesHeader but impossible i am receiving datatype conversion errors all the time even though i have tried any possible form ... I am also receiving the same error when trying to update especially Datetime fields!

I need to do this because i have to import them daily

Unable to open SQL Server database file (.mdf)

$
0
0
Experts,

I have a SQL Server 2005 database file (a .mdf file) that I am trying to open in SQL Server Management Studio so I can add a field to a table, but I am unable to open the file. I can't say that I really understand how SQL Server handles these databases. I especially don't understand the "attaching" and "detaching" operations.

I am working in VB.Net 2008 now, but my background is with VB6 using the JET engine. It was just so straightforward using the JET engine, but seems so much more complicated with SQL Server. I am trying to use .mdf files the same way I used .mdb files. I want my application to find the database file, "attach to it", and let me manipulate it.

At one time I was able to open my database in Sql Server Management Studio and edit the design of the database. The application still works but I am no longer able to modify the database because I cannot attach to it in Management Studio.

Here is a big clue: the files are no longer in the special folder anymore, which is c:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\. I might have deleted the files, stupidly, thinking they were redundant. I still have the .mdf file (and the _log.ldf file) on my hard drive and the application can still open it, but when I try to use Management Studio to attach to the .mdf file, I get this error:

Microsoft SQL Server Management Studio Express
An error occurred when attaching the database(s). Click the hyperlink in the Message column for details.

here are the details:
Unable to open the physical file "c:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\HEALSExamsSQL.mdf". Operating system error 2: "2(The system cannot find the file specified.)". (.Net SqlClient Data Provider)

Indeed the file is not there, but why is Mgmt Studio looking there? Why doesn't it just open the file where it is? What can I do to get it back? I even copied the files to c:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\? I get the same error.

Here is another clue: In Management Studio, when I right-click Databases, and chose Attach, it brings up a dialog. There I click "Add" to get another dialog in which I will select a database, but before the dialog appears I get this error:

Locate Database Files - KURANT-WIN7\SQLEXPRESS
C:\Users\Jason Kurant\Desktop
Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists.

If you know that the service account can access a specific file, type in the full path for the file in the File Name control in the Locate dialog box.

This suggests to me that there is some access control issue, but I can't figure out what it is. Can anyone suggest a way to fix this?

Altering the Collation of NAV SQL-Database not working - NAV 2015

$
0
0
Hey guys,

after successfully upgrading our solution from 2009R to 2015 i've run into a problem with the sorting of fields.

Sorting in 2009R2
  • AL-PHA
  • ALPHA
  • BE-TA
  • BETA
Sorting in 2015
  • ALPHA
  • AL-PHA
  • BETA
  • BE-TA

I've already changed the collation of the databse using the msdn Altering Databases - Collation Tab Guide to change the defaults datbase collation, but all columns in all tables kept the wrong sorting. Before upgrade the property was "<Default Database>", after the upgrade each column has a specific value instead of the default one.

Any ideas how to fix that to keep the old sorting from 2009R2?

Update Posted Sales Transaction Fact Table

$
0
0
I cannot use ISNULL , If you look at my screenshot I am trying to update the actual sales cost , sales support and sales cost , all these dimensions related to the sales amount(actual) , cost amount (actual) in the Value entry table

my script to update the fields marked in orange on my screenshot is

UPDATE [dbo].[Posted Sales Transactions_R]
SET [Cost Amount] = ([Cost Amount] + [Sales Costs (Actual)])
WHERE [Item Charge No.] = 'FOBB'

UPDATE [dbo].[Posted Sales Transactions_R]
SET [Sales Costs (Actual)] = ''
WHERE [Item Charge No.] = 'FOBB'

UPDATE [dbo].[Posted Sales Transactions_R]
SET [Sales Costs FCY] = 0
WHERE [Item Charge No.] = 'FOBB'

But the script is still not adding the sales cost amount into that fields. the sales cost amount is -198,132.61 , this amount should be in the Sales Cost , Sales Support and Actual Sales Cost fields. in short , FOBB is calculated as our Freight Charges

My posted sales transactions table is a fact table within my cube


SQL Server Reporting Services installation and configuration

Installation of SQL server 2012 on windows 8.1

Cannot Open Dynamics NAV with a replicated Database!

$
0
0
Hi! Experts

I was able to replicate an NAV test Database to another server instances. I used Transaction Replication. This was successful, whenever a transaction was completed in the original database, the results could be seen in the replicated SQL Database (e.g. posting sales orders). However, when I connected the replicated Database to an NAV instance and started running NAV, the program returned a fatal Error.

Later, I took backup of the replicated database and restored it to a new database. The same issue came up. I even cleared up the Access Control table, User, and the session list.

Your support is appreciated.

Thanks.

An ODBC error occurred, but no error information

$
0
0
SLQ 2008 R2
NAV 4.0 SP3
Scenario: Sales-post is called by a document, in codeunit 22, the insertitemledgerentry function is going into error on a random document line when it is called by itemqtyposting function. (although it's always the same line in a document, no relation between the different lines that give the error is detected)

Error:
"An ODBC error occurred, but no error information could be retrieved.
Contact your system manager."

And I can't find anything that might give me more information, no erors in eventvwr or sqllog.

client montior shows me this:
Item ledger entry:[??][item ledger entry no][item no.],[date],[sourcetype (customer) ],[Source No],[location code],[quantity],[quantity remaining], ...

This one works: previous lines aswell that are applied (this one isen't, see remaining quantiyt -6.0000)
exec sp_execute 99,20831957,'B7167','2012-06-13 00:00:00',1,'12270','SH212009290','','NEWWHS',-6.00000000000000000000,-6.00000000000000000000,0,0,1,'','',0,1,0,'','','FR','','2012-06-13 00:00:00','A1223-0166','','','S-SHPT','','',1.00000000000000000000,'PC',0,'','','',0,'203',0,'','','',0,'1753-01-01 00:00:00',0,0,0,0,'','','','1753-01-01 00:00:00','1753-01-01 00:00:00',''

This one does not work, 
exec sp_execute 99,20831958,'B7189','2012-06-13 00:00:00',1,'12270','SH212009290','','NEWWHS',-1.00000000000000000000,0,0,0,0,'','',0,1,0,'','','FR','','2012-06-13 00:00:00','A1223-0166','','','S-SHPT','','',1.00000000000000000000,'PC',0,'','','',0,'203',0,'','','',0,'1753-01-01 00:00:00',0,0,0,0,'','','','1753-01-01 00:00:00','1753-01-01 00:00:00',''
Steps taken:
Compile everything again and synchronise users.

I'm at a loss, has anyone seen a similar error and/or behaviour, or does anyone have suggestions to try some steps?

How to install Nav 2016 with the Always on feature of the SQL 2014 Enterprise ?

$
0
0
Need to implement Always on and the problem is that NAV will store data (licence) in the master database and that the master database is not replicated from one cluster to the other one.
is it possible to replicate $ndo$srvproperty manualy by script ?

LEFT JOIN

$
0
0
Hi

I am using Microsoft Dynamics NAV 2013 , SQL server 2014 , Tableau Desktop

I have created a new table which contains data from the Excise Rate, Location , Item and Item Unit of Measure tables in order to calculate Transfer Excise. Transfer Excise is Tax that we pay when our wine gets transported from one Warehouse to another. I did a Left Join to the Value Entry table which contains all item related transactions as I need the Invoice Quantity column to calculate Transfer Excise. This is how I calculate Transfer Excise: (Invoiced Quantity / Litre Conversion Factor * Unit Rate) = Transfer Excise. With this approach I did get the desired result , see the SQL script to get the Transfer Excise

SELECT DISTINCT b.[Entry No_] ,
a.[Starting Date],
b.[Posting Date],
b.[Item No_],
b.[Invoiced Quantity],
b.[Sales Amount (Actual)],
a.[Litre Conversion Factor],
a.[Unit Rate] ,
b.[Location Code],
a.[Excise Location],
a.[Excise Type Code],
a.[Unit Of Measure Code]
FROM [Spier Live$Value Entry] b
LEFT JOIN [Transfer Excise Tbl] a
ON a.[No_] = b.[Item No_]
AND b.[Location Code] = a.[Location Code]
AND DateDiff(y,b.[Posting Date],a.[Starting Date]) > -365
AND DateDiff(y,b.[Posting Date],a.[Starting Date]) < 0
WHERE b.[Posting Date] > '2013-02-26'
AND b.[Gen_ Bus_ Posting Group] IN ('LOCA','EXSA')
AND b.[Invoiced Quantity] <>0

GROUP BY b.[Entry No_] ,a.[Starting Date], b.[Posting Date], b.[Item No_], b.[Invoiced Quantity],
b.[Sales Amount (Actual)], a.[Litre Conversion Factor], a.[Unit Rate] ,
b.[Location Code], a.[Excise Location], a.[Excise Type Code], a.[Unit Of Measure Code]


With all this done , the sales amount (Actual) value changes which should not be the case. Someone told me that it might be the Left Join causing the Sales Amount(Actual) to change. I cannot change the script because then the Transfer Excise Value will be incorrect or is there another or better way of writing this query so that the sales amount (Actual) and Transfer Excise values will remain the same. Oh the reason for the way i wrote the query is because i want to get the Unit Rate for each item transaction.

SQL data types represented in MS NAV

$
0
0
Hello, i'm using Nav 2016, so i try to get data from other sql data base by using table (prop. external SQL), it's look good, but i've got some conflict:
1. i can't represent column with datatype smalling in MS Nav
2. i can't represent column with datatype nvarchar(max) in MS Nav (there's the limint in 250 char.)
As i understood, there are no data types, which are corresponded with this sql data type
So, can You help me, how i can solve this problems or should i use other mechanism to get data ?

Thank for your responses,

How to get data from Excel into a SQL table

$
0
0
Hello everyone.

I have an Excel spreadsheet with a few thousand items in there with the weight - just two columns. What I want to do is for each "Item" in the spreadsheet column "A" get the weight from column "B" and populate the weight field in my Item table in SQL.

Can anyone show me a script by which I could achieve this?

Thanks!

Ian

PS - this is NAV2009R2 so I guess a dataport would work too but I'm not a NAV developer and I don't have a developer licence.

'TableData 2000000001' doesn't exist and ndo problems

$
0
0
I have just migrated my NAV4 SP1 database from SQL 2000 to SQL 2008 through an SQL restore.


I' have windows authentication and various roles per user. Users with SUPER rights are getting the error that 'TableData 2000000001' does not exist.

Users with other roles are getting the error that 'The Execute permission was denied on the object 'xp_ndo_enumusergroups' database 'master' schema 'dbo'

I've registered the ndo procedures, any ideas?

thanks millions!

copy data from one table to another but only data fields are called exactly the same

$
0
0

Good morning to everyone s,

SQL Server 2003 R2

I need to copy data from one table to another but only data fields are called exactly the same.

tabla_A fields: field1, field2, field3, field4, campo5, campo6

talba_B fields: field2, field3, field4, campo5, field8, campo9

You need to copy data from field2, field3, field4 and campo5 of tabla_A in tabla_B, a new record

although obviously do not know the names of all fields since they are hundreds, I just need to know what are called exactly the same and copy data

I searched the code but I have not found :(

thanks in advance

Sales for customer

$
0
0
Hi all,

I'm fairly new here so please bear with me :)

I'm writing TSQL for simple report which shows Sales (LCY) by customer. As a reference I'm using the Customer Statistics window to check if my values are correct.

Initially I went with the Value Entry table by summing the Sales Amount (Actual) column. The reason is the report also includes other fields for the report such as Item No. This method shows the correct Sales figure for most customers except some.

I've then replicated in TSQL the same logic as the Sales (LCY) flow field on the Customer table (summing the Sales (LCY) column from the Cust Ledger Entry table) which as expected consistently gives me the same figure as on the NAV window.

My question is why are the sales values different for some customers? Am I missing anything obvious here?

Below is a stripped down TSQL code I've used for testing. The results from Value Entry table seems to be less than expected.

select sum([Sales Amount (Actual)]) from [MYCOMPANY].[dbo].[MYCOMPANY$Value Entry]
where [Source No_] = '8127743'
and year([Posting Date]) = 2015

select sum([Sales (LCY)]) from [MYCOMPANY].[dbo].[MYCOMPANY$Cust_ Ledger Entry]
where [Customer No_] = '8127743'
and year([Posting Date]) = 2015

Error executing procedure from access

$
0
0
Good morning experts !!

I have a procedure in SQL Server 2012 that uses views from another database on another server with SQL Server 2008, the SQL procedure runs smoothly.

It happens that this procedure I have to run it from Access (Microsoft Office Professional Plus 2010) by a pass-through query.

The user who runs it has all the permissions on both servers in both views and in the procedure, in the connection string of the pass-through query the correct user name appears; But when the query is executed it does not recognize the user name and the error that I attached

Needless to say, ODBC does the test perfectly smoothly.

Is it possible to say in the procedure with which user is to be executed? I can not think of anything else.

Thank you very much.
Viewing all 116 articles
Browse latest View live


Latest Images