Windows 8 Tools, SDK And Documentation

The Windows 8 release preview is out!

You could watch for the new apps including Bing Travel plus gaming and Music Xbox apps that integrate with Zune passes.

Microsoft is already rolling out the Windows Upgrade Offer in 131 markets, which will give consumers easy options to help them upgrade to Windows 8 when it becomes generally available.

You could  download the tools and SDK or explore the documentation.

Advertisements
Posted in General | Tagged | Leave a comment

Filetable – SQL Server 2012

With the new SQL server 2012 , Microsoft has packed a whole new bunch of features ! One among them is the ‘FileTable’ . The name it self suggest it all ! As per MSDN :

SQL Server provides a special table of files, also referred to as a FileTable, for applications that require file and directory storage in the database, with Windows API compatibility and non-transactional access. A FileTable is a specialized user table with a pre-defined schema that stores FILESTREAM data, as well as file and directory hierarchy information and file attributes.

But there are some PER-REQUISITES for using this FileTable :

  • FILESTREAM should be enabled at the Instance level
  • FILESTREAM FILEGROUP should be provided at the database level
  • Enable Nontransaction access at the database level
  • Specify directory for FileTable at the database level

Below mentioned steps would enable you to start using FILETABLE:

Now,  enable FILESTREAM on the instance level. Execute the following command and see if the FILESTREAM feature is already enabled.

select value,value_in_use from sys.configurations where name like 'filestream access level'

If the value is 0, then FILESTREAM support is disabled for that instance. If the value is 1 then FILESTREAM is available for TSQL access. If the value is 2, then FILESTREAM access is enabled both for Transact SQL access and Win32 streaming access.

Create folder E:\MyFiles.

Now we need to enable the next three per-requisites, its easy to do it in a script instead of creating a database and altering the properties. So, let us create the database with FILESTREAM File group and enable it in Non Transaction level. Also we could provide the folder location for the FILESTREAM folder.

/****** Object:  Database [MyDB]    Script Date: 5/23/2012 4:25:56 PM ******/
CREATE DATABASE [MyDB]
 CONTAINMENT = NONE
 ON  PRIMARY
( NAME = N'MyDB_Data', FILENAME = N'E:\Data\MyDB_Data.mdf' , SIZE = 2112KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ),
 FILEGROUP [MyFilestreamFG] CONTAINS FILESTREAM  DEFAULT
( NAME = N'MyFileStreamData', FILENAME = N'e:\myfiles\Data' , MAXSIZE = UNLIMITED)
 LOG ON
( NAME = N'MyDB_Log', FILENAME = N'E:\Data\MyDB_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [MyDB] SET COMPATIBILITY_LEVEL = 110
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [MyDB].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

Now, we shall create the table as Filetable,  by using the following Transact SQL statement.

Use MyDB
go

CREATE TABLE MyDataFiles AS FileTable
WITH
(
    FileTable_Directory = 'MyDataFiles',
    FileTable_Collate_Filename = database_default
);
GO

This will cretae a folder MyDataFIles under the default filestream location :

\\hostname\sqlinstance\FileTable\MyDataFiles

You can query the filestream options defined for every database using the following TSQL query.

select db_name(Database_id) as DBName,* from sys.database_filestream_options

These are the things you could experiment with initially :

Now let us try to query the table that we created as File Table, using the following query.

Use MyDB
go
select * from MyDataFiles

Let’s copy some files to the MyDataFiles folder under the FILESTREAM share. (* the path i had specified above)

Now let’s try to query the table that we created as File Table using the following query.

select stream_id, name,file_type, last_access_time  from MyDataFiles

This query will list all the files that you have copied to the folder. If you want to update these physical files, you could do even that. For instance renaming of a file could be done like this :

UPDATE
MyDataFiles SET
name = 'RenameTextFile.txt' WHERE
stream_id = '4F464AB6-18A5-E111-BDE0-00505694001D'

If you  delete a row from the table, it will delete the actual physical file as well. Execute the following TSQL command and check it out:

delete MyDataFiles where name='data.csv'

Thus an entire new concept / feature has been introduced in SQL Server 2012 to deal with files and directories.

You could explore more from MSDN articles here. Happy exploring !

Posted in Database | Tagged , | Leave a comment

Understanding Sequences and their use – SQL Server 2012

As per MSDN ,

A sequence is a user-defined schema-bound object that generates a sequence of numeric values according to the specification with which the sequence was created. The sequence of numeric values is generated in an ascending or descending order at a defined interval and may cycle (repeat) as requested. Sequences, unlike identity columns, are not associated with tables. An application refers to a sequence object to receive its next value. The relationship between sequences and tables is controlled by the application. User applications can reference a sequence object and coordinate the values keys across multiple rows and tables.

A sequence can be created using the CREATE SEQUENCE  statement.

CREATE SEQUENCE [schema_name . ] sequence_name
    [ AS [ built_in_integer_type | user-defined_integer_type ] ]
    [ START WITH <constant> ]
    [ INCREMENT BY <constant> ]
    [ { MINVALUE [  ] } | { NO MINVALUE } ]
    [ { MAXVALUE [  ] } | { NO MAXVALUE } ]
    [ CYCLE | { NO CYCLE } ]
    [ { CACHE [ <constant> ] } | { NO CACHE } ]
    [ ; ]

An example could be found on these statements here in an older post.

When to use sequences :

  • The application requires a number before the insert into the table is made.
  • The application requires sharing a single series of numbers between multiple tables or multiple columns within a table.
  • The application must restart the number series when a specified number is reached. For example, after assigning values 1 through 10, the application starts assigning values 1 through 10 again.
  • The application requires sequence values to be sorted by another field. The NEXT VALUE FOR function can apply the OVER clause to the function call. The OVER clause guarantees that the values returned are generated in the order of the OVER clause’s ORDER BY clause.
  • An application requires multiple numbers to be assigned at the same time. For example, an application needs to reserve five sequential numbers. Requesting identity values could result in gaps in the series if other processes were simultaneously issued numbers. Calling sp_sequence_get_range can retrieve several numbers in the sequence at once.
  • You need to change the specification of the sequence, such as the increment value.
Posted in Database | Tagged , | Leave a comment

Sequences in SQL Server 2012

Sequences where for Oracle until now 😉

Now, SQL Server 2012 comes with a nice and simple to use Sequence Feature like Oracle.

An example sequence ‘countToten’ which would have sequence from 1 to 10 could be created like this :

CREATE SEQUENCE countToten
   AS tinyint
    START WITH 1
    INCREMENT BY 1
    MINVALUE 1
    MAXVALUE 10
    CYCLE ;
GO

To reset the sequence to 1 you can use the following query:

ALTER SEQUENCE countToten
 RESTART WITH 1 ;

Finally, if it is necessary to drop the sequence, you can use the DROP SEQUENCE

drop sequence countToten

Winding up with an example :

Create a table with one int column, and insert data from the sequence.

CREATE TABLE seqTest
(column1 INT)
GO
INSERT seqTest(column1) values
(NEXT Value for countToten),
(NEXT Value for countToten),
(NEXT Value for countToten),
(NEXT Value for countToten),
(NEXT Value for countToten)

😉 Happy Sql Coding !

Posted in Database | Tagged , | 1 Comment

Firefox Download File Feature Not Working

I just got stuck with a weird issue on Firefox Browser.

Any file I try to download, it just gives me nothing but a blank downloads list !

Tried all these options initially , which is what any one does as the primary troubleshooting steps.

1. Cleared Cache ( everything! )

2. Got latest updates

3. Repaired

4. Checked for virus attacks

5. Cleared all download history etc

All these attempts failed 😦

Finally got it solved by doing these steps 🙂

1. Open Firefox

2. Go to Help -> Troubleshooting Information

3. On the applications basics section, click , ‘Open Containing Folder’.

4. Close Firefox

5. In the containing folder , delete the file  ‘ downloads.sqlite’.

6. Restart Firefox .

Bingo !! Issue solved !

 

Posted in General | Tagged | Leave a comment

Email Router -Configure the MS CRM deployment

Once you have successfully done the previous step 1 , step 2 and step 3 , then this post would be a continuation .

1. Click the Deployments tab.

2. Click New to create a new deployment.Make sure that the Deployment option is set to Microsoft Dynamics CRM Online.

3. For Microsoft Dynamics CRM Server, type the URL address of Microsoft Dynamics CRM Online. To do this, enter https://dev.crm.dynamics.com/OrganizationUniqueName where OrganizationUniqueName is a placeholder for the actual ID of your organization. Make sure you punch in the correct crm, crm5, crm4 accordingly.

6. For User Name and Password, type a Windows Live ID for a user in your Microsoft Dynamics CRM Online organization who has the System Administrator role.

7. For Incoming configuration profile, select the incoming profile that you created.

8.  For Outgoing configuration profile, select the outgoing profile that you created.

9. Click on Load Users and if everything is fine,all the users would be loaded.

10. Test the settings.

11. All is well, PUBLISH !

*If you want to change the Incoming or Outgoing configuration profile that will be used for a particular user, double-click the user record to open it, change the selection for the Incoming Configuration Profile or Outgoing Configuration Profile, and then click OK

Posted in MS CRM | Tagged , , , | 1 Comment

Configure Email Router for Online MS CRM 2011 Hotmail Accounts

Once , Microsoft Dynamics CRM 2011 E-mail Router installation is done successfully as per the post , it is time to have the router configurations done.

** Here the post talks about an online CRM instance where the users are the having windows live id which are Hotmail emails. Other mails work as well, provided you provide the basic pop and SMTP information correctly.

The steps to follow are :

1. Have the MS CRM Users configured correctly.

– Make sure their primary email is right.

– Email Access Configuration needs to be set to Email Router. Default is usually Outlook.

Email Access Config_ms crm

– Approve the user’s email.

Approve email in MS CRM 2011

3. Start the E-mail Router Configuration Manager.

4. Click Configuration Profiles and then click New.

5.Create a new Outgoing Profile with details as shown in the pic below. This one is for Hotmail emails.

Outgoing email profile : EMail Router MS CRM 2011 Online

Outgoing Server (SMTP Server): smtp.live.com
Outgoing Server SMTP Port: 25
Outgoing Server Authentication: Yes
Outgoing Server TLS or SSL : Yes

6. Now create a new profile for incoming. As in pic below for a Hotmail SMTP relay.

Incoming Profile : Email ROuter for MS CRM 2011 Online

Incoming Server (POP3 Server): pop3.live.com
Incoming Server POP Port: 995
Incoming Server POP SSL Encryption: Yes (On or Required)

7. Once the incoming and outgoing profiles are set. The next step is to Configure the Microsoft Dynamics CRM deployment.

8. Once Deployed, publish and you are ready !

Posted in MS CRM | Tagged , , , | 3 Comments