Converting SQL Server code to PostgreSQL
Key Takeaways
Google Cloud's Database Migration Service is used to convert SQL Server code to PostgreSQL, with Gemini as a trusted AI tutor, covering key differences in syntax and best practices for migration.
Full Transcript
If you've spent years writing T-SQL and SQL Server, switching to Postgres can feel extra awkward. The syntax is close, but not quite, and those small differences can really trick you up. Google Cloud's Database Migration Service acts like a hands-on translator. It lets you explore Postgres fundamentals using the schemas you already know, so you can learn faster with fewer roadblocks. [music] Here's a standard SQL Server create table statement for a products table. [music] On the right is the Postgres version that DMS generated automatically. Let's break down the key differences. [music] First up, the primary key. T-SQL uses identity for auto-incrementing IDs. DMS maps this to Postgres's identity. Is there any difference between them? Let's ask Gemini. >> [music] >> Gemini explains that DMS uses the recommended SQL standard compliant syntax, generated as identity. DMS also educates us about Postgres version differences. Until version 10, it relied on a specific pseudo type called serial to achieve this. In one click, Gemini [music] has educated and shown us the Postgres way to handle auto-incrementing keys without needing to search or guess. >> [music] >> Next, the is active column. SQL Server uses the bit data type. DMS maps it to boolean. Gemini confirms this is the idiomatic type for true false values in Postgres. A common mistake here is defaulting to an int for flags when Postgres already gives you a proper boolean type. >> [music] >> Finally, the default value for our timestamp. T-SQL uses getdate. [music] DMS maps this to Postgres's local timestamp. Local timestamp is the standard Postgres [music] function for returning the current time without time zone information at the start of the transaction. [music] That makes it the correct equivalent for getdate. DMS also notes the mapping from datetime [music] two to timestamp without time zone, which can be shortened to timestamp, to ensure precision and time zone unaware behaviors are maintained. These small, accurate translations add up. >> [music] >> With Gemini and DMS, you don't have to stop and search every unfamiliar keyword. You recognize the pattern, >> [music] >> apply what you know, and keep moving. Are you ready to start? Use the DMS conversion workspace to migrate your own SQL Server code today. The link is in the description below. >> [music] [music]
Original Description
Database Migration Service → https://goo.gle/48NKXTj
Developers migrating apps to the cloud who need to convert database schemas and code to PostgreSQL, or anyone looking to improve PostgreSQL skills, can rely on Gemini as a trusted AI tutor on Google Cloud.
Watch along to learn how to convert SQL Server T-SQL code into PostgreSQL while translating data types such as IDENTITY and BIT into their modern PostgreSQL equivalents. Gemini doesn't just convert code—it explains how the process works so developers can become PostgreSQL experts too.
Watch more Gemini taught me PostgreSQL → https://goo.gle/ai-postgres-tutor
🔔 Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech
#GoogleCloud #PostgreSQL
Speakers: Gabe Weiss
Products Mentioned: Database Migration Service, Gemini
More on: SQL Analytics
View skill →Related Reads
📰
📰
📰
📰
How to Format Your TDS Draft: A New and Improved Guide
Towards Data Science
Retrieving Data from a Database Using SQLAlchemy ORM
Medium · Data Science
Why Consumer EEG Devices Struggle With Signal Quality (And What the Data Actually Shows)
Medium · Data Science
Governed reports with Amazon Quick Desktop and Amazon FSx for NetApp ONTAP
AWS Machine Learning
🎓
Tutor Explanation
DeepCamp AI