Database objects not getting created in .sql file

Hi,

I'm experiencing some peculiar behaviour when building my datadude project

  • When I right-click-->Build the resultant .sql file does not contain any of the objects (tables, keys, sprocs etc...)within my project. I have checked each individual object and they all have BuildAction='Build'.
  • Anything that has BuildAction='PostDeploy' DOES end up in the resultant .sql file.
  • The even stranger thing is that all those objects have been in my project for some time. I then added a completely new table and then built the project again. The resultant .sql file ONLY contained the creation statement for this new object (plus all the BuildAction='PostDeploy' stuff).
  • This behaviour is consistent across both of my datadude projects.
  • It is also consistent when I issue msbuild.exe MyProjName.dbproj

 

This all seems very strange.

 

Questions:

  1. Anyone any idea why this might be
  2. It it my understanding that is flawed here

 

Thanks

Jamie

 

 




Answer this question

Database objects not getting created in .sql file

  • forrestcupp

    JoyceWang_MSFT wrote:

    Hi Jamie,

    Please check your Build property page, where you can specify the target database name and target connection server. My guess is that you have a database (the same name as the target database or the project) on that specific server. When you deploy, Datadude will check if there is an existing database on your target server. If the names match, Datadude will consider this deployment as an incremental deploy, thus only the difference (in your case the extra table) will be deployed. One way to change this behavior is to check the option "always re-create database" in the build property page. This way, the deploy script will have all objects in your project.

    Hope this helps,

    Joyce

    Joyce,

    Unfortunately not, no. I can promise you that the following is true:

    1. "Always recreate database" is checked. I can prove this because one thing that DOES end up in the script is:

    IF (DB_ID(N'MyDB') IS NOT NULL)

    DROP DATABASE [MyDB];

    2. A database with the same name does not exist on the target server. I even pointed "Target Connection" at a different server and got the same behaviour.

    Any other ideas

    -Jamie



  • Denvas

    I am surprised. If it is not an issue for you, could you please share your offline database project Or simply just the .dbproj file and .dbproj.user file At least we can start the investigation from there.

    Thanks,

    Joyce


  • Airan

    Hi Jamie,

    Please check your Build property page, where you can specify the target database name and target connection server. My guess is that you have a database (the same name as the target database or the project) on that specific server. When you deploy, Datadude will check if there is an existing database on your target server. If the names match, Datadude will consider this deployment as an incremental deploy, thus only the difference (in your case the extra table) will be deployed. One way to change this behavior is to check the option "always re-create database" in the build property page. This way, the deploy script will have all objects in your project.

    Your second post - try check the option "Generate DROP statements for objects that are in the target database but that are not in the database project". You'll see the difference.

    Hope this helps,

    Joyce


  • mohit sharma

    Even stranger....

    I have just this minute removed a table from the offending project and built it again. This didn't cause any of the objects within my project to appear in the resultant .sql file but a stored procedure that commits (amongst other things) an insertion into this removed table but which ISN'T EVEN IN MY PROJECT has suddenly appeared in the .sql file.

    I'm utterly baffled. I know I haven't given you much to go on but if anyone can hazard a guess as to what is happening then I'd be very grateful.

    -Jamie



  • LeoSly

    JoyceWang_MSFT wrote:

    I am surprised. If it is not an issue for you, could you please share your offline database project Or simply just the .dbproj file and .dbproj.user file At least we can start the investigation from there.

    Thanks,

    Joyce

    I would be glad to. But I can't do it here. Could you email me at jamieDOTthomsonATconchangoDOTcom and I'll send it to you

    Thanks

    Jamie



  • Database objects not getting created in .sql file