This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE a | |
set a.Score = _TARGET.Score | |
FROM McD_ROI_Hex_All_Afternoon a | |
JOIN [SandBox].dbo.[McD_ROI_Hex_Timebuckets] AS _TARGET | |
ON a.SP_GEOMETRY.STContains(_TARGET.SP_GEOMETRY) = 1 | |
AND a.Sum_Avg_Users = _TARGET.Sum_Avg_Users; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE dbo.YourTable | |
ADD ID INT IDENTITY | |
CONSTRAINT PK_YourTable PRIMARY KEY CLUSTERED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use sqlcmd tool just like below: | |
SQLCMD -S TestSQLServer\SQLEXPRESS -U sa -P sasa -d AdventureWorks2018 -i "d:\document\sql document\script.sql" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create table with PRIMARY_KEY | |
CREATE TABLE dbo.AuditLog | |
( | |
AuditLogID int constraint PK_AuditLog_AuditLogID primary key | |
) | |
2. Create table with unique clustered | |
CREATE UNIQUE CLUSTERED INDEX PK_AuditLog_AuditLogID | |
ON dbo.AuditLog(AuditLogID) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT [SUBURB] | |
,[COLUMN_TYPE] | |
,[HEIGHT] | |
,[COLUMN_MATERIAL] | |
,[OUTREACH_ARM_LENGTH] | |
,[LUMINAIRE] | |
,[LAMP_TYPE] | |
,[LAMP_COUNT] | |
,[LAT] | |
,[LON] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BULK INSERT dbo.output | |
FROM 'F:\Temp\Prezka\transformData\output2.csv' | |
WITH | |
( | |
FIRSTROW = 2, | |
FIELDTERMINATOR = ',', --CSV field delimiter | |
ROWTERMINATOR = '0x0a', -- \n | |
ERRORFILE = 'F:\Temp\Prezka\transformData\errors.csv', | |
TABLOCK | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE online_bookstore.book SET unit_price = TRUNCATE(RAND()*(10-5)+5,2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE [YOUR_TABLE] SET [POINT_GEOM] = geometry::STPointFromText('POINT(' + CAST([X] AS VARCHAR(20)) + ' ' + CAST([Y] AS VARCHAR(20)) + ')', 4326); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require(mongoose), | |
User = require(./user-model); | |
var connStr = mongodb://localhost:27017/mongoose-bcrypt-test; | |
mongoose.connect(connStr, function(err) { | |
if (err) throw err; | |
console.log(Successfully connected to MongoDB); | |
}); | |
// create a user a new user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require("mongoose"); | |
var bcrypt = require("bcrypt"); | |
var Schema = mongoose.Schema; | |
const SALT_WORK_FACTOR = 10; | |
var UserSchema = new Schema({ | |
email: { type: String, required: true, index: { unique: true } }, | |
password: { type: String, required: true } | |
}); |