DEV Community

Clever Cottonmouth
Clever Cottonmouth

Posted on

SQL SERVER

COPY ALL DATA TO NEW TABLE

SELECT a.* INTO newTable
FROM oldTable a;
Enter fullscreen mode Exit fullscreen mode

CAST

CAST(columnName as VARCHAR)
CAST(columnName as INT)
Enter fullscreen mode Exit fullscreen mode

COUNT SUM OF MULTIPLE TABLE

SELECT SUM(K) AS Total_Row_Count
FROM (
SELECT COUNT(*) FROM TABLE1
UNION
SELECT COUNT(*) FROM TABLE2
) A;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay