Thursday, January 7, 2016

Get the days that are not holiday or weekend

Hi all,
Today I posted how you can Get the days that are not holiday or weekend.

// Get the days that are not holiday or weekend
//-----Define Local Parameters---------
{
Var Name DataType Subtype Length
No StartDate Date
No EndDate Date
//-----Define Return type---------
Name WorkDays
ReturnType Integer
//-----Define Local variabls---------
Name DataType Subtype Length
DateRec Record Date [where Table ID: 2000000007]
HolidayRec Record Shop Calendar Holiday     [where Table ID: 99000753]
}
//-----Define Function---------
GetWorkingDays(StartDate : Date;EndDate : Date) WorkDays : Integer
// Strat ---------------------->>
WorkDays := 0;
DateRec.RESET;
HolidayRec.RESET;

DateRec.SETRANGE("Period Type",DateRec."Period Type"::Date);
DateRec.SETRANGE("Period Start",StartDate,EndDate);
DateRec.SETRANGE("Period No.",1,5);  // Get only weekdays
IF DateRec.FINDFIRST THEN
  REPEAT
    IF NOT HolidayRec.GET('HLP',DateRec."Period Start") THEN
      WorkDays += 1;
  UNTIL DateRec.NEXT = 0;
EXIT(WorkDays);
// End <<------------------------


Thanks & Best Wishes
Binesh Singh Rajput
(MCP, MS, MCTS)


Monday, December 28, 2015

All Virtual Tables in Microsoft Dynamics NAV 2016

Hi all,
Today I posted All Virtual Tables in Microsoft Dynamics NAV 2016,

Table No.
Table Name
2000000001
Object
2000000007
Date
2000000009
Session
2000000020
Drive
2000000022
File
2000000024
Monitor
2000000026
Integer
2000000028
Table Information
2000000029
System Object
2000000038
AllObj
2000000039
Printer
2000000040
License Information
2000000041
Field
2000000042
OLE Control
2000000043
License Permission
2000000044
Permission Range
2000000045
Windows Language
2000000046
Automation Server
2000000047
Server
2000000048
Database
2000000049
Code Coverage
2000000055
SID - Account ID
2000000058
AllObjWithCaption
2000000063
Key
2000000070
Error List
2000000101
Debugger Call Stack
2000000102
Debugger Variable
2000000103
Debugger Watch Value
2000000135
Table Synch. Setup
2000000136
Table Metadata
2000000137
CodeUnit Metadata
2000000138
Page Metadata
2000000139
Report Metadata
2000000140
Event Subscription
2000000141
Table Relations Metadata
2000000164
Time Zone
2000000167
Aggregate Permission Set


Thursday, December 24, 2015

Change SA Password in SQL Server Using TSQL Query

-- Change SA Password in SQL Server Using TSQL Query

USE master
GO
ALTER LOGIN [sa] WITH PASSWORD=N'NewSAPassword'
GO
-- F5
-- Run this query in SQL Server.
-- NewSAPassword is your new password, you can give another password also instead of
-- NewSAPassword.

-- You might be receive the below mentioned error message as the password specified does
-- not meet windows policy requirements because it is not complex enough.

-- Error Message
-- Msg 15118, Level 16, State 1, Line 1
-- Password validation failed. The password does not meet Windows policy requirements
-- because it is not complex enough.

-- It is always a best practice to set a complex password for an SA (System
-- Administrative Account) in SQL Server to avoid unauthorized access.
-- If you still want to set a simple password for an SA account in SQL Server which is
-- not recommended; then you add CHECK_POLICY = OFF clause to the above query.

USE master
GO
ALTER LOGIN [sa] WITH PASSWORD=N'NewSAPassword', CHECK_POLICY = OFF
GO
--F5
-- There may be a scenario that once you try logging in to SQL Server using SA Password
-- you get the below mentioned error.

-- Error Message
-- Login failed for user 'sa'. Reason: The account is disabled. (Microsoft SQL Server,
-- Error: 18470)

-- Enable SA Account in SQL Server
-- In such a scenario you need to go ahead and run the below TSQL code to enable SA
-- account in SQL Server.

USE master
GO
ALTER LOGIN [sa] ENABLE

Popular Posts